method
quic.QuicSession.destroy
Immediately destroy the session. All streams will be destroyed and the session will be closed. If error is provided and [session.onerror][] is set, the onerror callback is invoked before destruction. The session.closed promise will reject with the error. If options is provided, the CONNECTION_CLOSE frame sent to the peer will include the specified error code, type, and reason.
Referenced types
interface SessionDestroyOptions
- code?: number | bigint
The error code to include in the
CONNECTION_CLOSEframe sent to the peer. Default:0(no error). - reason?: string
An optional human-readable reason string included in the
CONNECTION_CLOSEframe. Per RFC 9000, this is for diagnostic purposes only and should not be used for machine-readable error descriptions. - type?: 'transport' | 'application'
Either
'transport'or'application'. Determines the error code namespace used in theCONNECTION_CLOSEframe. When'transport'(the default), the frame type is0x1cand the code is interpreted as a QUIC transport error. When'application', the frame type is0x1dand the code is application-specific. Default:'transport'.