Skip to content

Commit 695766d

Browse files
committed
doc: clarify setKeepAlive delay precision
1 parent f190a04 commit 695766d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

doc/api/net.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,9 @@ changes:
773773
the socket immediately after the connection is established, similarly on what
774774
is done in [`socket.setKeepAlive()`][]. **Default:** `false`.
775775
* `keepAliveInitialDelay` {number} If set to a positive number, it sets the
776-
initial delay before the first keepalive probe is sent on an idle socket. **Default:** `0`.
776+
initial delay, in milliseconds, before the first keepalive probe is sent on
777+
an idle socket. The value is rounded down to whole seconds before use.
778+
**Default:** `0`.
777779
* `noDelay` {boolean} If set to `true`, it disables the use of Nagle's algorithm
778780
immediately after the socket is established. **Default:** `false`.
779781
* `onread` {Object} If specified, incoming data is stored in a single `buffer`
@@ -1400,8 +1402,9 @@ Enable/disable keep-alive functionality, and optionally set the initial
14001402
delay before the first keepalive probe is sent on an idle socket.
14011403

14021404
Set `initialDelay` (in milliseconds) to set the delay between the last
1403-
data packet received and the first keepalive probe. Setting `0` for
1404-
`initialDelay` will leave the value unchanged from the default
1405+
data packet received and the first keepalive probe. The value is rounded down
1406+
to whole seconds before it is passed to the operating system. Values less than
1407+
`1000` ms become `0`, which leaves the value unchanged from the default
14051408
(or previous) setting.
14061409

14071410
Enabling the keep-alive functionality will set the following socket options:
@@ -1823,7 +1826,8 @@ changes:
18231826
similarly on what is done in [`socket.setKeepAlive()`][]. **Default:**
18241827
`false`.
18251828
* `keepAliveInitialDelay` {number} If set to a positive number, it sets the
1826-
initial delay before the first keepalive probe is sent on an idle socket.
1829+
initial delay, in milliseconds, before the first keepalive probe is sent on
1830+
an idle socket. The value is rounded down to whole seconds before use.
18271831
**Default:** `0`.
18281832
* `noDelay` {boolean} If set to `true`, it disables the use of Nagle's
18291833
algorithm immediately after a new incoming connection is received.

0 commit comments

Comments
 (0)