Skip to content

Sessions

First frame on the control stream. Header fields:

Key Field Req. Notes
14 versions MUST Protocol major versions the client supports, e.g. [1]
16 codecs MUST In preference order, e.g. ["cbor", "json"]
18 caps SHOULD Capabilities requested (§7.10)
21 limits SHOULD Client-side limits applying to frames sent to the client, same keys as in WELCOME (§7.2): max_calls (server-initiated calls), max_frame, window (WS credit), max_dgram
24 contract SHOULD SHA-256 fingerprint of the manifest the client was generated from (§12.5)
33 auth MAY {35: "bearer", 13: "<token>"}
20 resume MAY {13: resume_token, 19: session_id, 44: ack_map, 53: lost?} to resume a session (§7.8)
34 client SHOULD Client library name and version

Data section: empty in v1.

versions lists protocol major versions. Compatible revisions (1.x) do not change it; their additions are negotiated as capabilities (§7.10).

A HELLO whose limits advertise max_frame or window below 64 KiB violates the floor of §4.1. It is a malformed frame, handled like any other malformed frame as a PROTOCOL_ERROR (§5.4.1, §15.1).

The server MUST complete the handshake (send WELCOME or REJECT) within the handshake timeout (default 10 s) from transport establishment, or close with HANDSHAKE_TIMEOUT. The timeout covers receiving HELLO, authentication and the on-connect hook (§13.4), and so bounds the lifetime of all pre-authentication state (§4.1).

Key Field Req. Notes
15 version MUST Highest version present in both sides’ lists
17 codec MUST First codec in the client’s list the server supports
18 caps MUST Capabilities granted (§7.10); on resumption, the original grant (§7.8)
19 session MUST Session ID: public, stable across resumption, unique per endpoint across all nodes (≥ 96 bits of randomness or a node-prefixed counter), text, URL-safe [A-Za-z0-9_-], ≤ 64 chars. Never a credential.
13 token MUST if resume cap granted Resume token: secret, ≥128 bits random, rotated on every WELCOME
21 limits MUST Server limits, a map with integer keys: max_calls (48), max_frame (49), max_subs (50), max_dgram (51), and on WebSocket window (40, initial per-stream credit, §6.4). Prose in this document writes them as limits.max_frame and so on
22 hb MUST Heartbeat interval in ms
23 idle MUST Idle timeout in ms
37 resume_window MUST if resume granted How long the server keeps a detached session
24 contract SHOULD Server’s manifest fingerprint
36 user MAY Authenticated user ID, if any
43 resumed MUST when resuming true if HELLO.resume succeeded
44 ack MUST when resumed Per-lane highest contiguous seq the server received from the client (§7.8)
53 lost MUST when resumed and a gap was recorded for frames toward the client Lanes with a gap (§7.8)
46 transports MAY Bindings offered on this endpoint (§4.4)
  • The server MUST NOT send WELCOME before authentication (if required) has succeeded.
  • After WELCOME, both sides may open streams and send any frame permitted by the granted capabilities.
  • Contract mismatch: if fingerprints differ, the server applies its policy: warn (default; proceed) or strict (REJECT with CONTRACT_MISMATCH). Under strict, a HELLO without contract is treated as a mismatch; under warn it is logged. A server without a manifest omits key 24 and never rejects on fingerprints. Clients SHOULD surface a mismatch warning to developers.

Sent instead of WELCOME. Fields: code (§15.1), msg, optional retry (minimum ms before retrying, with the jitter of §7.6). The server closes the transport after sending REJECT. Typical codes: UNSUPPORTED_VERSION, UNAUTHENTICATED, FORBIDDEN, RESUME_FAILED, CONTRACT_MISMATCH, LIMIT_EXCEEDED (e.g. server at capacity, with retry).

A client receiving REJECT with RESUME_FAILED MUST start a new session (HELLO without resume); all session-scoped state is lost, and channels must be recovered via §10.5.

  • Each peer MUST send PING if it has sent nothing on the transport for hb ms (default 15,000).
  • PING’s data section MAY carry up to 8 opaque bytes; PONG MUST echo them. This allows RTT measurement. A PING whose data section exceeds 8 bytes is a PROTOCOL_ERROR.
  • A peer MUST answer every PING with PONG promptly, even under backpressure.
  • On WebTransport the server may advertise lower idle and hb values to fit the client’s QUIC idle timeout (§4.2).
  • If a peer receives nothing at all for idle ms (default 45,000), it MUST close with IDLE_TIMEOUT (or, if resumption is enabled, treat the transport as lost, §7.8).
  • Any received frame, on any stream, resets the idle timer.
  • Server-driven liveness for browsers: browsers throttle timers in background tabs (to as little as once per minute), so a client’s own PING timer is unreliable. A client MUST answer PING from its receive path (never from a timer), and a browser client SHOULD NOT declare the server dead purely on a timer: after a suspected gap it sends PING and waits one hb for PONG before treating the transport as lost. Servers therefore drive liveness: they PING on schedule and judge the client by PONGs. Server implementations SHOULD tolerate late PONGs from clients that report a browser user agent by using the full idle window rather than a shorter PONG deadline.
  • PING rate limit: a peer receiving more than 10 PINGs in hb ms without any other traffic SHOULD close with LIMIT_EXCEEDED (the gRPC “too many pings” lesson). As a token bucket (§16): capacity 10, refilled at 10 per hb, one token per received PING; any other received frame refills the bucket to capacity. A PING that finds the bucket empty exceeds the limit.
  • Initial: credentials in HELLO auth, or cookies on the upgrade request. The server validates them before WELCOME. Failure → REJECT UNAUTHENTICATED or FORBIDDEN.
  • Principal: the authenticated principal is fixed for the session. On resumption, the resumed transport’s credentials (if any) MUST resolve to the same principal, or the server MUST REJECT with RESUME_FAILED. Two principals are the same when the authenticator’s stable principal ID is equal (by default the user ID). An anonymous session can be resumed only by an anonymous HELLO.
  • Expiry notice: the server MAY send AUTH_EXPIRING {38: ms_until_expiry} before the credential expires.
  • Refresh: AUTH_REFRESH {1: rid, 33: auth} replaces the credential in-band. The server answers AUTH_RESULT {1: rid, 6: code, 38: expires?} where code 0 = accepted. A malformed AUTH_REFRESH (missing or ill-typed fields, or a scheme the server’s authenticator does not accept) is answered with REQUEST_ERROR INVALID_ARGUMENT (§7.9); the authenticator declares the schemes it accepts, and unknown header keys are ignored (§5.4.1). A credential the authenticator evaluated and refused is answered with AUTH_RESULT carrying UNAUTHENTICATED (invalid or expired) or PERMISSION_DENIED (a different principal); in both cases the session continues with the old credential until it expires.
  • Expiry without refresh: the server MUST close the session with UNAUTHENTICATED. Servers MAY allow a grace period; the default is 0 s (§16). An AUTH_REFRESH received before the session is closed is processed first, and if it is accepted the session continues. A detached session (§7.8) runs no expiry timer; its credential is checked at resume: if it has expired and HELLO carries no fresh auth, the server answers REJECT RESUME_FAILED.
  • Re-evaluation: authorization decisions are not permanent. After a successful AUTH_REFRESH and after every resumption, the server MUST re-evaluate the authorization of every active channel subscription (UNSUBSCRIBED code 1 on failure). Servers SHOULD also re-check on a configurable interval or when their policy source signals a change.

Announces server draining (deploys, rebalancing).

  • Fields: code (usually GOING_AWAY), msg, optional url (endpoint to reconnect to), optional retry.
  • After GOAWAY the server MUST answer every new client-initiated CALL, on either binding, with ERROR UNAVAILABLE (nx: true) and MUST let calls in progress finish until a drain deadline (default 5 min, §16). The client learns per call which requests were not processed; no stream-ID watermark is needed.
  • The client SHOULD open a new session (to url if given), move new traffic to it, and close the old session once its calls complete.
  • When draining ends, the server sends CLOSE GOING_AWAY.
  • GOAWAY does not use resumption: the new session is a new session. Servers that want state continuity SHOULD rely on channel recovery (§10.5) and the backplane.
  • Staggered draining: when draining many sessions (deploy, scale-in), a server MUST spread GOAWAYs over a drain window (default 60 s, §16) and SHOULD set retry with per-session jitter, so reconnects do not arrive as a thundering herd. retry is a floor: clients MUST wait at least retry and add their own jitter of up to +20 % on top (a delay of retry × U(1.0, 1.2)).
  • Maximum session age: servers SHOULD send GOAWAY after a configurable maximum session age (default 4 h ± 10 % jitter) so that long-lived sessions rebalance across nodes after scale-outs (the gRPC MAX_CONNECTION_AGE lesson). Clients treat this like any other GOAWAY.
  • Fields: code (§15.1), optional msg.
  • The sender closes the transport after CLOSE (WebSocket close code 4000 + code; WebTransport session close with code).
  • The transport-level close reason is the CLOSE msg, truncated on a UTF-8 character boundary to the transport’s limit (1024 bytes for the WebTransport close capsule, 123 bytes for a WebSocket close frame).
  • A session closed with CLOSE is not resumable, whatever the code.
  • A transport that drops without CLOSE is a transport loss: the session becomes detached and resumable if resumption is enabled (§7.8); otherwise it ends.

Control-stream operations that expect a reply (AUTH_REFRESH, SUBSCRIBE, UNSUBSCRIBE) carry a request ID rid, unique among the sender’s outstanding requests. Under resumption, control requests and their replies (SUBSCRIBED, REQUEST_ERROR, AUTH_RESULT, and an UNSUBSCRIBED carrying a rid) are never evicted from the replay buffer (§7.8). The reply carries the same rid. A failed request is answered with REQUEST_ERROR {1: rid, 6: status_code, 7: msg} using call status codes (§15.2).

Capabilities are negotiated in HELLO/WELCOME caps. calls is always granted, whether or not HELLO lists it; every other granted capability is in the requested set. A HELLO without caps requests only calls.

Capability Meaning
calls Calls and notifications (always granted in v1)
server-calls The server may call client methods
streams Stream shapes 1-3
resume Session resumption (§7.8)
channels Channels (§10)
history Channel history and recovery (§10.5)
presence Presence (§10.6)
datagrams Datagrams (§11)
lanes Lanes (§9.2)
idempotency Server honors pavia-idempotency-key (§8.7)

Using a feature whose capability was not granted is a PROTOCOL_ERROR. Two cases are not such a use: pavia-idempotency-key without idempotency is ordinary metadata (§8.7), and a HELLO carrying resume to a server that does not grant it is answered as in §7.8.


From the specification: §7.1, §7.2, §7.3, §7.4, §7.5, §7.6, §7.7, §7.9, §7.10.