Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/WebSocketServer.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ If true, the server will automatically send a ping to all clients every `keepali
**keepaliveInterval** - uint - *Default: 20000*
The interval in milliseconds to send keepalive pings to connected clients.

**keepaliveForce** - boolean - *Default: false*
if true, the server will not reset the keepalive timer when any data is received from the client, forcing to send the ping on the Interval.

**dropConnectionOnKeepaliveTimeout** - boolean - *Default: true*
If true, the server will consider any connection that has not received any data within the amount of time specified by `keepaliveGracePeriod` after a keepalive ping has been sent. Ignored if `keepalive` is false.

Expand Down
4 changes: 3 additions & 1 deletion lib/WebSocketConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ WebSocketConnection.prototype.handleGracePeriodTimer = function() {
WebSocketConnection.prototype.handleSocketData = function(data) {
this._debug('handleSocketData');
// Reset the keepalive timer when receiving data of any kind.
this.setKeepaliveTimer();
if (!this.config.keepaliveForce) {
this.setKeepaliveTimer();
}

// Add received data to our bufferList, which efficiently holds received
// data chunks in a linked list of Buffer objects.
Expand Down