SocketCluster / SocketCluster/socketcluster

pingTimeout/pingInterval: ping timeout could occur even without sending ping requests

Open
#505 2 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

The documentation at https://socketcluster.io/#!/docs/api-socketcluster reads:

// The interval in milliseconds on which to
// send a ping to the client to check that
// it is still alive
pingInterval: 8000,

// How many milliseconds to wait without receiving a ping
// before closing the socket
pingTimeout: 20000,

Usually the timeout starts to tick after the ping request has been sent. In other words - if no reply is received for 20000ms after the ping request is sent, then the connection would be considered broken and would be disconnected.

However that is not the case with socketcluster where pingTimeout denotes that at least one ping response should be received within those 20000ms regardless of how many ping requests have been sent during that time, if any.

This could lead to the absurd situation of disconnecting due to ping timeout even though not a single ping request has been sent. To observe that set pingInterval to a higher number than pingTimeout.

If changing the behavior is not feasible, then at least an update of the documentation above is warranted to make that clear.

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 reviewing the pingInterval and pingTimeout documentation at the linked SocketCluster API page, then locate the connection heartbeat handling that determines when the timeout begins. Compare behavior when pingInterval exceeds pingTimeout and decide whether the intended fix is implementation or documentation; done means the observed behavior and documented semantics agree, with coverage for the reported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.