method Socket.prototype.setKeepAlive
Jump to headingSocket.prototype.setKeepAlive(enable?: boolean,initialDelay?: number,): thisEnable/disable keep-alive functionality, and optionally set the initial delay before the first keepalive probe is sent on an idle socket.
Set initialDelay (in milliseconds) to set the delay between the last
data packet received and the first keepalive probe. Setting 0 forinitialDelay will leave the value unchanged from the default
(or previous) setting.
Enabling the keep-alive functionality will set the following socket options:
SO_KEEPALIVE=1TCP_KEEPIDLE=initialDelayTCP_KEEPCNT=10TCP_KEEPINTVL=1
Parameters Jump to heading
optional
Jump to headingenable: boolean = falseoptional
Jump to headinginitialDelay: number = 0Return Type Jump to heading
thisThe socket itself.