server.close([callback])


阻止服务器建立新的会话。这并不会因为 HTTP/2 会话的持久性而阻止创建新的请求流。要优雅地关闭服务器,请在所有活动会话上调用 http2session.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.】

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

【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.】