http2session.destroy([error][, code])


  • error <Error> 如果 Http2Session 因错误而被销毁,则返回一个 Error 对象。
  • code <number> 在最终 GOAWAY 帧中发送的 HTTP/2 错误代码。如果未指定,且 error 不为未定义,则默认为 INTERNAL_ERROR,否则默认为 NO_ERROR

立即终止 Http2Session 及相关的 net.Sockettls.TLSSocket

🌐 Immediately terminates the Http2Session and the associated net.Socket or tls.TLSSocket.

一旦被销毁,Http2Session 会触发 'close' 事件。如果 error 不为 undefined,则 'error' 事件会在 'close' 事件之前立即触发。

🌐 Once destroyed, the Http2Session will emit the 'close' event. If error is not undefined, an 'error' event will be emitted immediately before the 'close' event.

如果有任何仍然打开的与 Http2Session 关联的 Http2Streams,它们也将被销毁。

🌐 If there are any remaining open Http2Streams associated with the Http2Session, those will also be destroyed.