An endpoint sends a GOAWAY message to inform the peer it intends to close
the session soon. When sent by a server, it can initiate session migration
(Section 3.6) with an optional URI. When sent by a client, the New
Session URI MUST be zero length.
The GOAWAY message does not impact subscription state. A subscriber SHOULD individually UNSUBSCRIBE for each existing subscription, while a publisher MAY reject new requests after sending a GOAWAY.
Upon receiving a GOAWAY, an endpoint SHOULD NOT initiate new requests to the peer including SUBSCRIBE, PUBLISH, FETCH, PUBLISH_NAMESPACE, SUBSCRIBE_NAMESPACE and TRACK_STATUS.
Sending a GOAWAY does not prevent the sender from initiating new requests, though the sender SHOULD avoid initiating requests unless required by migration (see (Section 8.4.1 and Section 8.5.1). An endpoint that receives a GOAWAY MAY reject new requests with an appropriate error code (e.g., REQUEST_ERROR with error code GOING_AWAY).
The endpoint MUST close the session with a PROTOCOL_VIOLATION
(Section 3.5) if it receives multiple GOAWAY messages.
GOAWAY Message {
Type (vi64) = 0x10,
Length (16),
New Session URI Length (vi64),
New Session URI (..),
Timeout (vi64),
}
-
New Session URI: When received by a client, indicates where the client can connect to continue this session. The client MUST use this URI for the new session if provided. If the URI is zero bytes long, the current URI is reused instead. The new session URI SHOULD use the same scheme as the current URI to ensure compatibility. The maximum length of the New Session URI is 8,192 bytes. If an endpoint receives a length exceeding the maximum, it MUST close the session with a
PROTOCOL_VIOLATION.If a server receives a GOAWAY with a non-zero New Session URI Length it MUST close the session with a
PROTOCOL_VIOLATION. -
Timeout: The time in milliseconds the sender will wait for the session to be gracefully closed before closing the session with
GOAWAY_TIMEOUT. A value of 0 indicates the sender has no specific timeout, and the recipient SHOULD still close the session as quickly as possible. This is a hint; the sender of the GOAWAY MAY close the session before the indicated timeout has elapsed.