Skip to content

Commit ef2a0bd

Browse files
sagitsofantargos
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. PR-URL: #22798 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9e1f736 commit ef2a0bd

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
@@ -1615,6 +1615,7 @@ added: v8.4.0
16151615

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

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

1632+
#### server.setTimeout([msecs][, callback])
1633+
<!-- YAML
1634+
added: v8.4.0
1635+
-->
1636+
1637+
* `msecs` {number} **Default:** `120000` (2 minutes)
1638+
* `callback` {Function}
1639+
* Returns: {Http2Server}
1640+
1641+
Used to set the timeout value for http2 server requests,
1642+
and sets a callback function that is called when there is no activity
1643+
on the `Http2Server` after `msecs` milliseconds.
1644+
1645+
The given callback is registered as a listener on the `'timeout'` event.
1646+
1647+
In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK`
1648+
error will be thrown.
1649+
16311650
### Class: Http2SecureServer
16321651
<!-- YAML
16331652
added: v8.4.0
@@ -1728,6 +1747,7 @@ added: v8.4.0
17281747

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

17321752
#### Event: 'unknownProtocol'
17331753
<!-- YAML
@@ -1751,6 +1771,24 @@ Note that this is not analogous to restricting new requests since HTTP/2
17511771
connections are persistent. To achieve a similar graceful shutdown behavior,
17521772
consider also using [`http2session.close()`] on active sessions.
17531773

1774+
#### server.setTimeout([msecs][, callback])
1775+
<!-- YAML
1776+
added: v8.4.0
1777+
-->
1778+
1779+
* `msecs` {number} **Default:** `120000` (2 minutes)
1780+
* `callback` {Function}
1781+
* Returns: {Http2SecureServer}
1782+
1783+
Used to set the timeout value for http2 secure server requests,
1784+
and sets a callback function that is called when there is no activity
1785+
on the `Http2SecureServer` after `msecs` milliseconds.
1786+
1787+
The given callback is registered as a listener on the `'timeout'` event.
1788+
1789+
In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK`
1790+
error will be thrown.
1791+
17541792
### http2.createServer(options[, onRequestHandler])
17551793
<!-- YAML
17561794
added: v8.4.0

0 commit comments

Comments
 (0)