Skip to content

Commit

Permalink
Implements keep alive options.
Browse files Browse the repository at this point in the history
  • Loading branch information
benbotto committed Dec 13, 2019
1 parent 607aa29 commit 288d997
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class Connection extends EventEmitter {
this.stream = opts.config.stream;
}

// Enable keep-alive on the socket.
this.stream.setKeepAlive(true, 10000);
// Enable keep-alive on the socket. It's disabled by default, but the
// user can enable it and supply an initial delay.
if (typeof this.stream.setKeepAlive === 'function' && this.config.enableKeepAlive)
this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);

this._internalId = _connectionId++;
this._commands = new Queue();
Expand Down

0 comments on commit 288d997

Please sign in to comment.