Skip to content

Socket connection gets timed out unexpectedly #580

@psk001

Description

@psk001

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions