stream.onreset


  • 类型:quic.OnStreamErrorCallback

当对等方通过发送 RESET_STREAM 帧中止流的某个方向(对等方放弃其可写端,因此我们的可读端将不再接收数据)或发送 STOP_SENDING 帧(对等方要求我们停止在可写端写入)时要调用的回调。

🌐 The callback to invoke when the peer aborts a direction of the stream by sending a RESET_STREAM frame (the peer abandons their writable side, so no further data will arrive on our readable side) or a STOP_SENDING frame (the peer asks us to stop writing on our writable side).

回调接收一个 Node.js 错误,其 errorCode (bigint) 属性携带来自数据帧的应用错误代码。

🌐 The callback receives a Node.js error whose errorCode (bigint) property carries the application error code from the wire frame.

当此回调触发时,流不会自动销毁——应用可以选择如何响应。常见模式是:忽略(并继续使用双向流中仍然活跃的方向)、使用 writer.fail() 中止另一方向,或使用 stream.destroy() 拆除整个流。读取/写入。

🌐 The stream is not automatically destroyed when this callback fires — the application chooses how to react. Common patterns are: ignore (and continue using the still-active direction on a bidirectional stream), abort the other direction with writer.fail(), or tear down the whole stream with stream.destroy(). Read/write.