Skip to content
Sign upLog in
← Back to Community

wtf is up with repl and websockets

Profile icon
realTronsiHacker

using websockets in repl:

I've asked this question before but it never worked

const ws = new WebSocket("wss://replname")
const ws = new WebSocket("wss://replname:port")

neither works

The server code is such:

const WebSocket = require("ws") const wss = new WebSocket.Server({ port: 3001 })

Every NodeJS related program coded in other IDEs such as ATOM or VS Code breaks upon forking into repl.

Voters
Profile icon
Simple21
Profile icon
AndrewJefferso1
Profile icon
DigiLab
Profile icon
realTronsi
Comments
hotnewtop
Profile icon
AndrewJefferso1

this is such a pain

Profile icon
AndrewJefferso1

this does work for me, at least if I put the websocket on the same port as http, which should be fine: here's an example https://replit.com/@AndrewJefferso1/websocket-example

Profile icon
Coder100

iirc just do const ws = new WebSpcket("wss://replname");

Profile icon
realTronsi

@Coder100
ik but that doesn't work on repl idfk why. repl is broken

Profile icon
Coder100
Profile icon
Coder100

http server?

@realTronsi

Profile icon
realTronsi

@Coder100
yep, but repl is https so obviously ws:// doesn't work

Profile icon
realTronsi

@Coder100
I feel like this is a bug at this point