From 93a39e70a215365e013e7e52d6950531e56f028e Mon Sep 17 00:00:00 2001 From: Sagi Tsofan Date: Tue, 11 Sep 2018 01:14:10 +0300 Subject: [PATCH 1/9] Http2 timeout documentation Added into documentation new default timeout value of "2 minutes" inside 2 classes under "Event: 'timeout'" 1) Class: Http2SecureServer 2) Class: Http2Server --- doc/api/http2.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index fac5a5f23be7aa..c0608cfa7c39bd 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1615,6 +1615,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]) + +* `msecs` {number} **Default:** `120000` (2 minutes) +* `callback` {Function} +* Returns: {Http2SecureServer} + +Sets the timeout value for http2 secure server requests, and emits a `'timeout'` event on +the Server object if a timeout occurs. + +By default, the Server's timeout value is 2 minutes, if a callback is assigned +to the Server's `'timeout'` event, timeouts must be handled explicitly. + +In case of no callback were assigned, a new `ERR_INVALID_CALLBACK` error will be throwen. + #### server.close([callback]) + +* `msecs` {number} **Default:** `120000` (2 minutes) +* `callback` {Function} +* Returns: {Http2SecureServer} + +Sets the timeout value for http2 secure server requests, and emits a `'timeout'` event on +the Server object if a timeout occurs. + +By default, the Server's timeout value is 2 minutes, if a callback is assigned +to the Server's `'timeout'` event, timeouts must be handled explicitly. + +In case of no callback were assigned, a new `ERR_INVALID_CALLBACK` error will be throwen. + #### server.close([callback]) - -* `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} -* Returns: {Http2Server} - -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 Http2Server after `msecs` milliseconds. -The given callback is registered as a listener on the 'timeout' event. +Stops the server from accepting new connections. See [`net.Server.close()`][]. -In case of no callback were assigned, a new `ERR_INVALID_CALLBACK` -error will be throw. +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.close([callback]) +#### server.setTimeout([msecs][, callback]) + +* `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} +* Returns: {Http2Server} -Stops the server from accepting new connections. See [`net.Server.close()`][]. +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. -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. +The given callback is registered as a listener on the `'timeout'` event. + +In case of no callback were assigned, a new `ERR_INVALID_CALLBACK` +error will be thrown. ### Class: Http2SecureServer - -* `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} -* Returns: {Http2Server} - -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 Http2Server after `msecs` milliseconds. -The given callback is registered as a listener on the 'timeout' event. +Stops the server from accepting new connections. See [`tls.Server.close()`][]. -In case of no callback were assigned, a new `ERR_INVALID_CALLBACK` -error will be throw. +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.close([callback]) +#### server.setTimeout([msecs][, callback]) + +* `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} +* Returns: {Http2SecureServer} -Stops the server from accepting new connections. See [`tls.Server.close()`][]. +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. -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. +The given callback is registered as a listener on the `'timeout'` event. + +In case of no callback were assigned, a new `ERR_INVALID_CALLBACK` +error will be thrown. ### http2.createServer(options[, onRequestHandler])