server.close([callback])


停止服务器建立新会话。 由于 HTTP/2 会话的持久性,这不会阻止创建新的请求流。 要正常地关闭服务器,则在所有活动会话上调用 http2session.close()

如果提供了 callback,则在所有活动会话都关闭之前不会调用它,尽管服务器已经停止允许新会话。 有关详细信息,请参阅 tls.Server.close()

Stops the server from establishing new sessions. This does not prevent new request streams from being created due to the persistent nature of HTTP/2 sessions. To gracefully shut down the server, call http2session.close() on all active sessions.

If callback is provided, it is not invoked until all active sessions have been closed, although the server has already stopped allowing new sessions. See tls.Server.close() for more details.