From 84fa6eb1730229022ca5ba47d11543cb916b0692 Mon Sep 17 00:00:00 2001 From: Chris Miller Date: Wed, 4 Apr 2018 13:32:18 +0100 Subject: [PATCH] doc, http2: add sections for server.close() Clarify current behavior of http2server.close() and http2secureServer.close() w.r.t. perceived differences when compared with httpServer.close(). Fixes: https://github.com/nodejs/node/issues/19711 Backport-PR-URL: https://github.com/nodejs/node/pull/20456 PR-URL: https://github.com/nodejs/node/pull/19802 Reviewed-By: Vse Mozhet Byt Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- doc/api/http2.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index 5259f567b22a09..052860566fd441 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1544,6 +1544,18 @@ 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()`. +#### server.close([callback]) + +- `callback` {Function} + +Stops the server from accepting new connections. See [`net.Server.close()`][]. + +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. + ### Class: Http2SecureServer +- `callback` {Function} + +Stops the server from accepting new connections. See [`tls.Server.close()`][]. + +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. + ### http2.createServer(options[, onRequestHandler])