SocketCluster / SocketCluster/socketcluster

Socket connection gets timed out unexpectedly

Open
#580 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.2k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

I am using socketcluster-server on server side. On client side I use simple websocket to connect to server.
My connection parameters are-

let agOptions = { handshakeTimeout: 60000, pingInterval: 50000, pingTimeout: 90000 };
As seen in agOptions, pingTImeout is 90 seconds, which means that the connection should be alive even if there is no communication between client and server for 90s. On client side, I have a ping mechanism which sends ping at interval of 10 seconds in the format mentioned below.
{ "event":"#publish", "data":{ "channel":"some-channel", "data":{ "socketId":"", "event":"ping", "auth":"" } } }
The server responds to the ping by sending a pong in the below :
{ "event": "#publish", "data": { "channel": "some-other-channel-subscribed-by-client", "data": { "event": "pong", "message": "#2" } } }

I expect this mechanism to keep connection alive as the client and server and client communicate continuously.
This things works very well on localhost.
But when this is deployed on a kubernetes cluster, it gets disconnected after random intervals. Sometimes 40s other time 100s.
How do i fix it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the disconnect in the Kubernetes deployment, comparing it with localhost while checking the client heartbeat settings and the server's pong behavior described in the issue. Investigate the deployment's WebSocket connection and timeout configuration; done means connections remain stable beyond the reported random 40–100 second intervals.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, kubernetes, nodejs
Domain
backend, infrastructure, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.