Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorPaolo Insogna <paolo@cowtech.it>2022-02-22 13:58:30 +0300
committerGitHub <noreply@github.com>2022-02-22 13:58:30 +0300
commit45b5ca810a16074e639157825c1aa2e90d60e9f6 (patch)
tree7fda23d2b6c62d473e10db78aa2e9c9b95ad7793 /doc/api
parentc071bd581ae30585f5326ac0ce1cb0d80007664e (diff)
net: add new options to `net.Socket` and `net.Server`
PR-URL: https://github.com/nodejs/node/pull/41310 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/http.md12
-rw-r--r--doc/api/net.md19
2 files changed, 31 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md
index a0c27ea23d1..8c60b43c7e3 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -2865,6 +2865,16 @@ changes:
[`--max-http-header-size`][] for requests received by this server, i.e.
the maximum length of request headers in bytes.
**Default:** 16384 (16 KB).
+ * `noDelay` {boolean} If set to `true`, it disables the use of Nagle's
+ algorithm immediately after a new incoming connection is received.
+ **Default:** `false`.
+ * `keepAlive` {boolean} If set to `true`, it enables keep-alive functionality
+ on the socket immediately after a new incoming connection is received,
+ similarly on what is done in \[`socket.setKeepAlive([enable][, initialDelay])`]\[`socket.setKeepAlive(enable, initialDelay)`].
+ **Default:** `false`.
+ * `keepAliveInitialDelay` {number} If set to a positive number, it sets the
+ initial delay before the first keepalive probe is sent on an idle socket.
+ **Default:** `0`.
* `requestListener` {Function}
@@ -3108,6 +3118,8 @@ changes:
* `callback` {Function}
* Returns: {http.ClientRequest}
+`options` in [`socket.connect()`][] are also supported.
+
Node.js maintains several connections per server to make HTTP requests.
This function allows one to transparently issue requests.
diff --git a/doc/api/net.md b/doc/api/net.md
index c3f9a0c1316..4ecab258011 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -854,6 +854,14 @@ For TCP connections, available `options` are:
`0` indicates that both IPv4 and IPv6 addresses are allowed. **Default:** `0`.
* `hints` {number} Optional [`dns.lookup()` hints][].
* `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][].
+* `noDelay` {boolean} If set to `true`, it disables the use of Nagle's algorithm immediately
+ after the socket is established. **Default:** `false`.
+* `keepAlive` {boolean} If set to `true`, it enables keep-alive functionality on the socket
+ immediately after the connection is established, similarly on what is done in
+ [`socket.setKeepAlive([enable][, initialDelay])`][`socket.setKeepAlive(enable, initialDelay)`].
+ **Default:** `false`.
+* `keepAliveInitialDelay` {number} If set to a positive number, it sets the initial delay before
+ the first keepalive probe is sent on an idle socket.**Default:** `0`.
For [IPC][] connections, available `options` are:
@@ -1415,8 +1423,18 @@ added: v0.5.0
**Default:** `false`.
* `pauseOnConnect` {boolean} Indicates whether the socket should be
paused on incoming connections. **Default:** `false`.
+ * `noDelay` {boolean} If set to `true`, it disables the use of Nagle's algorithm immediately
+ after a new incoming connection is received. **Default:** `false`.
+ * `keepAlive` {boolean} If set to `true`, it enables keep-alive functionality on the socket
+ immediately after a new incoming connection is received, similarly on what is done in
+ [`socket.setKeepAlive([enable][, initialDelay])`][`socket.setKeepAlive(enable, initialDelay)`].
+ **Default:** `false`.
+ * `keepAliveInitialDelay` {number} If set to a positive number, it sets the initial delay before
+ the first keepalive probe is sent on an idle socket.**Default:** `0`.
+
* `connectionListener` {Function} Automatically set as a listener for the
[`'connection'`][] event.
+
* Returns: {net.Server}
Creates a new TCP or [IPC][] server.
@@ -1582,6 +1600,7 @@ net.isIPv6('fhqwhgads'); // returns false
[`socket.pause()`]: #socketpause
[`socket.resume()`]: #socketresume
[`socket.setEncoding()`]: #socketsetencodingencoding
+[`socket.setKeepAlive(enable, initialDelay)`]: #socketsetkeepaliveenable-initialdelay
[`socket.setTimeout()`]: #socketsettimeouttimeout-callback
[`socket.setTimeout(timeout)`]: #socketsettimeouttimeout-callback
[`writable.destroy()`]: stream.md#writabledestroyerror