WebSocket reconnecting behind Load Balancer


I’ve deployed RocketChay into Google Compute Engine behind a Load Balancer. I’ve noticed that WebSocket gets closed by the Load Balancer’s timeout, which by default is 30 seconds. When this happens, RocketChat generates a new WebSocket and the user sees “Connecting” in the UI. I’ve tried increasing the Load Balancer’s timeout, up to 90 seconds, and the same thing keeps happens (only that it happens after 90 seconds instead of 30).

In the internet I’ve found that the solution should be to send heartbeats through the WebSocket. Do you know if RocketChat should be in fact doing this? Anything I can do on my side to fix it?

Server Setup Information

  • Version of Rocket.Chat Server: 3.6.1
  • Operating System: Debian 10 Buster VM in Google Compute Engine
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version:
  • Proxy: Google Cloud Load Balancer
  • Firewalls involved: I guess Google Cloud as well