socketio / socketio/socket.io

NOOP interval/keepalive feature

Open
#4,868 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Is your feature request related to a problem? Please describe.
We experience on many machines, socket.io won't detect all websocket/tcp/network disconnects (like terminating vpn process, ripping out network cable, ...), until the ping-pong messaging occurs. But if we try to use the websocket (by sending something)
after the network loss/change, the disconnect is detected immediately by socket.io.

Our solution to this, to keep the detection time short, and avoid having too short ping-pong timing (which might cause issues if you have slow startup/wake, maybe lots of events?, high RTT?), has been to send a engine.io noop message every 2s. With that we detect network loss within 2s from the client side.

As a bonus it seems to keep some small portion of websockets alive, maybe because of increased traffic, that used to break somewhere approx every 5m. The default ping interval didn't stop this, but sending this noop every 2s seems to.

Describe the solution you'd like
It would be nice to have this as a feature, noopInterval or something like it, just sending noop or something else periodically when the connection is supposed to be open. Or some other way to solve the problem.

Describe alternatives you've considered
pingInterval+timeout, but we're afraid of setting those too low.

Additional context

Contributor guide

Open the contributing guide

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 engine.io ping/pong and noop behavior described in the issue, including how pingInterval and timeout currently detect disconnects. Define how a configurable periodic noop would interact with open connections, then verify that it detects network loss promptly without introducing overly aggressive ping-pong timing.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.