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
Percy
Percy2y ago
Project ID: N/A
angelo
angelo2y ago
WebSocket Connections Disconnecting
Steps to take to make sure that WebSockets are behaving as expected on the platform.
eirk
eirk2y ago
oof
0xlheras
0xlheras2y ago
Wow That was fast Thanks N/A
angelo
angelo2y ago
When you proxy requests at Railway scale, keep alive connections have to be killed.
0xlheras
0xlheras2y ago
So the only way to solve this problem is to add a domain?
angelo
angelo2y ago
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.
0xlheras
0xlheras2y ago
Ok, thanks a lot The problem persists after adding a domain
angelo
angelo2y ago
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
0xlheras
0xlheras2y ago
Thanks, but I'm already doing it And it happens exactly after 10 minutes
angelo
angelo2y ago
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.
0xlheras
0xlheras2y ago
A game
angelo
angelo2y ago
gtocha
0xlheras
0xlheras2y ago
It is in development
angelo
angelo2y ago
cool: project id?
0xlheras
0xlheras2y ago
576c94c0-d93a-420e-a522-38cd07a04f0f The problem is solved now I did not update the URL of the socket Thanks for your time