Skip to content

Commit bae7c60

Browse files
sagitsofanBethGriggs
authored andcommitted
doc: document http2 timeouts
New default timeout values of "2 minutes" were added into documentation inside 2 classes under "Event: 'timeout'": 1) Class: Http2SecureServer 2) Class: Http2Server New sections for `.setTimeout()` method were added inside `Http2SecureServer` & `Http2Server` docs. Backport-PR-URL: #22850 PR-URL: #22798 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 805bf40 commit bae7c60

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

doc/api/http2.md

+38
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,7 @@ added: v8.4.0
16041604

16051605
The `'timeout'` event is emitted when there is no activity on the Server for
16061606
a given number of milliseconds set using `http2server.setTimeout()`.
1607+
**Default:** 2 minutes.
16071608

16081609
#### server.close([callback])
16091610
<!-- YAML
@@ -1617,6 +1618,24 @@ Note that this is not analogous to restricting new requests since HTTP/2
16171618
connections are persistent. To achieve a similar graceful shutdown behavior,
16181619
consider also using [`http2session.close()`] on active sessions.
16191620

1621+
#### server.setTimeout([msecs][, callback])
1622+
<!-- YAML
1623+
added: v8.4.0
1624+
-->
1625+
1626+
* `msecs` {number} **Default:** `120000` (2 minutes)
1627+
* `callback` {Function}
1628+
* Returns: {Http2Server}
1629+
1630+
Used to set the timeout value for http2 server requests,
1631+
and sets a callback function that is called when there is no activity
1632+
on the `Http2Server` after `msecs` milliseconds.
1633+
1634+
The given callback is registered as a listener on the `'timeout'` event.
1635+
1636+
In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK`
1637+
error will be thrown.
1638+
16201639
### Class: Http2SecureServer
16211640
<!-- YAML
16221641
added: v8.4.0
@@ -1717,6 +1736,7 @@ added: v8.4.0
17171736

17181737
The `'timeout'` event is emitted when there is no activity on the Server for
17191738
a given number of milliseconds set using `http2secureServer.setTimeout()`.
1739+
**Default:** 2 minutes.
17201740

17211741
#### Event: 'unknownProtocol'
17221742
<!-- YAML
@@ -1740,6 +1760,24 @@ Note that this is not analogous to restricting new requests since HTTP/2
17401760
connections are persistent. To achieve a similar graceful shutdown behavior,
17411761
consider also using [`http2session.close()`] on active sessions.
17421762

1763+
#### server.setTimeout([msecs][, callback])
1764+
<!-- YAML
1765+
added: v8.4.0
1766+
-->
1767+
1768+
* `msecs` {number} **Default:** `120000` (2 minutes)
1769+
* `callback` {Function}
1770+
* Returns: {Http2SecureServer}
1771+
1772+
Used to set the timeout value for http2 secure server requests,
1773+
and sets a callback function that is called when there is no activity
1774+
on the `Http2SecureServer` after `msecs` milliseconds.
1775+
1776+
The given callback is registered as a listener on the `'timeout'` event.
1777+
1778+
In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK`
1779+
error will be thrown.
1780+
17431781
### http2.createServer(options[, onRequestHandler])
17441782
<!-- YAML
17451783
added: v8.4.0

0 commit comments

Comments
 (0)