property

quic.QuicSession.ongoaway

ongoaway: undefined | (this: QuicSession, lastStreamId: bigint) => void

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}:

  • When lastStreamId is -1n, the peer sent a shutdown notice (intent to close) without specifying a stream boundary. All existing streams may still be processed.
  • When lastStreamId is >= 0n, it is the highest stream ID the peer may have processed. Streams with IDs above this value were NOT processed and can be safely retried on a new connection.

After GOAWAY is received, session.createBidirectionalStream() will throw ERR_INVALID_STATE. Existing streams continue until they complete or the session closes.

This callback is only relevant for HTTP/3 sessions. Read/write.