Error 502 when connecting to my project's websocket

Hello,
On my project https://glitch.com/edit/#!/fragrant-cake, I’m trying to connect to wss://fragrant-cake.glitch.me/3000 on port 3000 (which is process.env.PORT) but I keep getting this error: WebSocket connection to 'wss://fragrant-cake.glitch.me/3000:3000' failed: Error during WebSocket handshake: Unexpected response code: 502.
Could anyone help me? Thanks

The process.env.PORT is just an internal redirect thing, can you get the desired result using the wss://fragrant-cake.glitch.me/3000 url?

No, it throws 502 errors.

I fixed it by using express-ws.

1 Like