An endpoint sends a GOAWAY message to inform the peer it intends to close
the session soon. Servers can use GOAWAY to initiate session migration
(Section 3.5) with an optional URI.
The GOAWAY message does not impact subscription state. A subscriber SHOULD individually UNSUBSCRIBE for each existing subscription, while a publisher MAY reject new requests while in the draining state.
Upon receiving a GOAWAY, an endpoint SHOULD NOT initiate new requests to the peer including SUBSCRIBE, PUBLISH, FETCH, ANNOUNCE and SUBSCRIBE_NAMESPACE.
The endpoint MUST terminate the session with a Protocol Violation (Section 3.4) if it receives multiple GOAWAY messages.
GOAWAY Message {
Type (i) = 0x10,
Length (16),
New Session URI Length (i),
New Session URI (..),
}
-
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 URL to ensure compatibility. The maxmimum 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 terminate the session with a Protocol Violation.