const ws_port = process.env.PORT;
const wss = new WebSocketServer({ port: ws_port });
console.log('listening for connections on %s...', ws_port);
When I deploy this server, I correctly see the log message:
listening for connections on 10000...
Locally, I can connect with ws://localhost:10000
But when I try connecting to my app using websockets on Render ws://myservice.onrender.com:10000
my request times out. Nothing shows up in the logs. I assume the ws request is getting blocked.
It seems like a common use case that should be possible. Is there a way to connect via websockets?
I’m unclear whether that means only secure traffic is allowed, or if it means other protocols are not supported. For instance, can I use secure websockets? (wss://)
As a side note, I’m using the free individual tier to prototype my socket service, and I’m noticing that my connections are closed after 5 minutes - even if they are actively sending messages. I’m hoping this is an artificial (and undocumented?) feature of the free tier.
On the plus side, it’s great for exercising my client’s reconnect logic.
Hi there,
It is a known bug we have of the free tier, if you bump up to a paid plan you probably won’t experience this - you can always return to free if it continues,