Hi,
I’m using Websockets (Socket.io) in my web application. The WebSockets get disconnected frequently (mostly every 30-40 seconds. However, they can sometimes hold the connection open for longer such as 3-4 minutes). When running my application locally, it works with no disconnections. After some debugging, I concluded that the issue is the hosting environment (or something in between, such as proxies) - something disconnects the connection on purpose rather than an application or network error.
Is it the intended behavior of Websockets with Koyeb?
Some other details:
Migrated from Heroku.
Application is Node.js back-end and Angular front-end (the front-end is hosted by a different provider - Cloudflare).
The disconnect error code (front-end) is 1005 or 1006 (I couldn’t yet figure out when which error gets emitted).
Tried lowering the ping interval to 10 seconds, however, regardless of the pings, the connection sometimes gets disconnected some milliseconds after I sent or received a message (not a ping one). So it rules out disconnections due to inactivity.
Couldn’t see any error on the server side (Koyeb) in my application run-time logs besides that the WebSocket gets disconnected.
Thanks a lot for the report. We’ve started investigating the issue and reproduced the disconnections you observed.
We’ll get back to you soon with more details
The TLDR is that we currently have a 120sec timeout on all connections, it doesn’t distinguish between idle and active connections, which is not the intended behavior.
We fixed the issue on most of our infrastructure but our global load balancer still doesn’t behave as we would like it to.
Hi @alisdair,
thank you for the update!
I’m developing an open-source browser extension that uses WebSockets for real-time, low-latency communication. In syncing two clients, connection reliability and latency play a significant role in the main logic.
We’re currently working on improvements to our load-balancing layer to support gRPC, I will check to see if we can solve the WebSockets timeout issue in the continuity of this improvement.