Socket disconnects after 10 minutes
Hi, I have a project with
node.js,
and I use ws
as the socket library. The socket connection closes after 10 minutes, even if messages are sent back and forward between the client and the server. I think the problem is not related to my code because when I run the server locally, I do not get the socket disconnected error, and the error code is 1006.
Is there any socket connection duration limit in the default configuration for the free tier?16 Replies
Project ID:
N/A
Boy do we have a fix for you: https://help.railway.app/troubleshooting/hKqw9Dr1moxfDySTy98E6G/websocket-connections-disconnecting/sb6bfjV6UnuMwkRyAvQ3Sb
WebSocket Connections Disconnecting
Steps to take to make sure that WebSockets are behaving as expected on the platform.
oof
Wow
That was fast
Thanks
N/A
When you proxy requests at Railway scale, keep alive connections have to be killed.
So the only way to solve this problem is to add a domain?
yes
Our guess, could be wrong is that if you are hosting a realtime application, it's likely its a serious usecase. Hence, most people who need it would likely be using a domain.
We have a fix on the way, but it will be a long time till we get to it.
Ok, thanks a lot
The problem persists after adding a domain
Yes, so the other thing you need to do is -> send some keepalive traffic on your websocket every 10-30 secs (socketio does this with websocket pings by default) so that you don't hit any TCP idle timeouts.
You are likely hitting timeouts
Thanks, but I'm already doing it
And it happens exactly after 10 minutes
Not great then, will talk to our engineer on that once they are awake.
What are you trying to host on here?
Personal project? Very commerical mission critical workload?
This will help me determine the priority.
A game
gtocha
It is in development
cool: project id?
576c94c0-d93a-420e-a522-38cd07a04f0f
The problem is solved now I did not update the URL of the socket
Thanks for your time