session.ongoaway
- 类型:<Function>
当对等方发送 HTTP/3 GOAWAY 帧时调用的回调,表示它正在启动优雅关闭。回调接收 (lastStreamId),其中 lastStreamId 是一个 {bigint}:
🌐 The callback to invoke when the peer sends an HTTP/3 GOAWAY frame,
indicating it is initiating a graceful shutdown. The callback receives
(lastStreamId) where lastStreamId is a {bigint}:
- 当
lastStreamId为-1n时,对端发送了关闭通知(意图关闭),但未指定流边界。所有现有的流仍可被处理。 - 当
lastStreamId为>= 0n时,它是对等方可能已处理的最高流 ID。ID 高于此值的流未被处理,可以在新连接上安全重试。
在接收到 GOAWAY 后,session.createBidirectionalStream() 将抛出 ERR_INVALID_STATE。现有的流将继续,直到它们完成或会话关闭。
🌐 After GOAWAY is received, session.createBidirectionalStream() will
throw ERR_INVALID_STATE. Existing streams continue until they
complete or the session closes.
此回调仅与 HTTP/3 会话相关。读/写。
🌐 This callback is only relevant for HTTP/3 sessions. Read/write.