Skip to content

Commit

Permalink
doc: document http2 timeouts
Browse files Browse the repository at this point in the history
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 <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
sagitsofan authored and BethGriggs committed Oct 16, 2018
1 parent 805bf40 commit bae7c60
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions doc/api/http2.md
Expand Up @@ -1604,6 +1604,7 @@ added: v8.4.0

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

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

#### server.setTimeout([msecs][, callback])
<!-- YAML
added: v8.4.0
-->

* `msecs` {number} **Default:** `120000` (2 minutes)
* `callback` {Function}
* Returns: {Http2Server}

Used to set the timeout value for http2 server requests,
and sets a callback function that is called when there is no activity
on the `Http2Server` after `msecs` milliseconds.

The given callback is registered as a listener on the `'timeout'` event.

In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK`
error will be thrown.

### Class: Http2SecureServer
<!-- YAML
added: v8.4.0
Expand Down Expand Up @@ -1717,6 +1736,7 @@ added: v8.4.0

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

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

#### server.setTimeout([msecs][, callback])
<!-- YAML
added: v8.4.0
-->

* `msecs` {number} **Default:** `120000` (2 minutes)
* `callback` {Function}
* Returns: {Http2SecureServer}

Used to set the timeout value for http2 secure server requests,
and sets a callback function that is called when there is no activity
on the `Http2SecureServer` after `msecs` milliseconds.

The given callback is registered as a listener on the `'timeout'` event.

In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK`
error will be thrown.

### http2.createServer(options[, onRequestHandler])
<!-- YAML
added: v8.4.0
Expand Down

0 comments on commit bae7c60

Please sign in to comment.