sockjs / sockjs/sockjs-node

Allow disabling or configuring of websocket's 10-second heartbeat timeout

Open
#219 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.1k
Forks
306
PR merge metrics
No merged PRs in 30d

Description

The websocket transport has a hardcoded 10 second timer:

https://github.com/sockjs/sockjs-node/blob/61bba467d9d6b980a651070ed563f59d812e824e/src/trans-websocket.coffee#L99

If the websocket is sending a large message over a slow link to the client, then it may take more than 10 seconds for the heartbeat to actually arrive. A big improvement would be to wait until the heartbeat is actually sent to start the timer, but even then, the client may have large messages it's sending to the server too, which a heartbeat response would be queued behind.

I'm not necessarily asking for a change to the default behavior, but it would be great to be able to disable or configure this timeout, like disconnect_delay for the xhr-based transports.

(If you like I can put together a PR for this, but I wanted to first ask if such a patch would be welcome.)

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 at src/trans-websocket.coffee around line 99, where the hardcoded 10-second heartbeat timer is described. Compare the timeout configuration used by the xhr-based transports, including disconnect_delay, and determine how a setting could disable or configure this timeout while preserving the current default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.