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


  • error <Error> 如果 Http2Session 因错误而被销毁,则为 Error 对象。

    ¥error <Error> An Error object if the Http2Session is being destroyed due to an error.

  • code <number> 要在最终 GOAWAY 帧中发送的 HTTP/2 错误代码。如果未指定,且 error 未未定义,则默认为 INTERNAL_ERROR,否则默认为 NO_ERROR

    ¥code <number> The HTTP/2 error code to send in the final GOAWAY frame. If unspecified, and error is not undefined, the default is INTERNAL_ERROR, otherwise defaults to NO_ERROR.

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

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

一旦销毁,则 Http2Session 将触发 'close' 事件。如果 error 未定义,则将在 'close' 事件之前立即触发 'error' 事件。

¥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.