Websockets disconnecting frequently

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 :slightly_smiling_face:


Thank you for the swift response, glad to know that this is indeed not the intended behavior as my app focuses heavily on WebSockets.

Are there any updates?

Hey @neyney10,

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.

We aim to release a fix in early December.