Skip to content

Streams

  • Stream 0 is the control stream. It exists from the start of the transport and is never closed independently of the session.
  • Client-initiated call and lane streams use even IDs ≥ 2; server-initiated ones use odd IDs ≥ 1.
  • Each initiator’s IDs MUST be strictly increasing. IDs MUST NOT be reused within a transport.
  • A stream is opened by the first frame carrying a new ID. That frame MUST be CALL (call stream) or LANE_OPEN (lane stream).
  • A non-opening frame for a stream ID at or below the initiator’s highest opened ID that is not currently open MUST be ignored (to tolerate races); an opening frame for such an ID is a PROTOCOL_ERROR. Receivers therefore need only the highest opened ID per initiator, not a set of closed IDs. Frames for a stream ID above that, other than an opening frame, are a PROTOCOL_ERROR.
  • On resumption over a new transport, stream ID numbering restarts; streams do not survive transport loss (§7.8).
  • The first frame from the client MUST be HELLO; the first frame from the server MUST be WELCOME or REJECT.
  • The server sends no frame other than WELCOME, REJECT or CLOSE before the handshake completes. The client MAY pipeline frames after HELLO (§4.1); they are processed only after WELCOME, in order.
  • On WebTransport, a FIN or reset of the control stream that was not preceded by CLOSE is a transport loss (§7.7): the session detaches if resumption is enabled and ends otherwise. Only CLOSE ends a session with no possibility of resumption.

Each call stream has two halves: caller → callee (request half) and callee → caller (response half).

Shape Request half Response half
Unary (0) CALL (half closed by CALL itself) RESULT or ERROR
Server stream (1) CALL (half closed by CALL itself) ITEM* then END, or ERROR at any point
Client stream (2) CALL, ITEM*, END RESULT or ERROR
Bidirectional (3) CALL, ITEM*, END ITEM* then END, or ERROR at any point
  • Terminal frames: RESULT, ERROR and callee-side END close the response half. END and CANCEL close the request half. For unary and server-stream calls CALL itself closes the request half, so CALL counts as the request half’s terminal frame for the FIN rule below.
  • A call is complete when both halves are closed, or when the callee sends RESULT or ERROR before the request half closed. On WebTransport, each side also FINs its QUIC send side after its terminal frame.
  • On a bidirectional call, a callee END sent while the request half is open closes only the response half. The call completes when the caller closes the request half with END or cancels it (CANCEL, or a reset on WebTransport). Only RESULT or ERROR completes a call before the request half closes.
  • The callee MAY close the response half (RESULT/ERROR) before the request half is closed, e.g. rejecting a client stream early. The request half is then closed implicitly: the callee frees the stream when it sends the terminal frame, the caller MUST stop sending ITEMs, and ITEMs or END already in flight are handled as frames on a closed stream (§6.1). On WebTransport the callee SHOULD send STOP_SENDING and the caller resets its send side.
  • Any frame after a terminal frame in the same half is a PROTOCOL_ERROR while the stream is open, except CANCEL, which the caller MAY send after END until the response half closes (§8.5). Once the call is complete, §6.1 applies.
  • On WebTransport, a QUIC stream reset (RESET_STREAM) by the caller MUST be treated as CANCEL; by the callee, as ERROR with code UNAVAILABLE unless a Pavia terminal frame was already received. A FIN on a half before its terminal frame (at a frame boundary, §5.3) is handled like RESET_STREAM on that half. A reset or FIN that arrives after the call is complete is ignored.

WebTransport: QUIC stream and connection flow control apply. Pavia adds nothing.

WebSocket: per-stream credit applies to call streams only.

  • Each call stream starts with a send window of window bytes in each direction: frames sent to the server use the server’s window (WELCOME limits.window), frames sent to the client use the client’s window (HELLO limits.window, default 256 KiB). The same rule applies to max_frame: each side’s advertised value bounds frames sent to it.
  • Only ITEM data sections consume credit. CALL, RESULT, ERROR, END, CANCEL and CREDIT do not.
  • A sender MUST NOT send an ITEM whose data section exceeds its remaining window. It waits for CREDIT.
  • A receiver grants more window with CREDIT {25: increment} on the same stream ID. Receivers SHOULD grant credit as the application consumes items, not as bytes arrive, so that backpressure reaches the sender.
  • An ITEM larger than the sender’s current window waits for CREDIT like any other. A receiver MUST eventually grant a blocked stream enough credit for the largest data section whose frame fits in max_frame, as the application consumes earlier items, so any ITEM that can be framed can be sent. An ITEM whose frame payload (Length, §5.2) would exceed the receiver’s max_frame is rejected locally with RESOURCE_EXHAUSTED and never sent. The rejection is reported only to the producing code; the call stays open.
  • The ITEM bytes in flight toward a peer are bounded by max_calls × window for that direction; there is no session-level credit (§18, item 7).
  • Exceeding the window is a PROTOCOL_ERROR.
  • Stream 0 has no credit. Its backpressure is governed by the slow-consumer policy (§13.5).
  • WELCOME limits.max_calls is the maximum number of concurrently open call streams the client may initiate. HELLO limits.max_calls is the same for server-initiated calls.
  • Client-initiated calls on WebTransport: enforced by QUIC MAX_STREAMS (§4.2); the advertised value is informational.
  • Client-initiated calls on WebSocket: a CALL exceeding the limit MUST be answered immediately with ERROR RESOURCE_EXHAUSTED (nx: true); the stream then closes normally for every shape (§6.3).
  • Server-initiated calls: the server MUST NOT exceed the client’s max_calls on either binding, because a browser client cannot set its own QUIC limits. A server-initiated call beyond it fails locally with RESOURCE_EXHAUSTED and nx: true.
  • Open/cancel rate: independent of concurrency, servers MUST rate-limit stream opens (CALL and LANE_OPEN on WebSocket, peer-opened QUIC streams on WebTransport) and CANCELs per session (default 1,000 per 10 s combined, as a token bucket, §16). A CALL immediately followed by CANCEL is cheap for the attacker and not for the server (the HTTP/2 “rapid reset” pattern). Exceeding the rate → CLOSE LIMIT_EXCEEDED.

A transport has one writer; without rules, a bulk stream starves the frames that keep the session healthy.

  • Priority classes, highest first: (1) PING, PONG, CLOSE; (2) CANCEL, CREDIT, RESULT, ERROR, END, ACK; (3) all other control-stream and lane-stream frames (HELLO, WELCOME, REJECT, GOAWAY, AUTH_*, REQUEST_ERROR, NOTIFY, LANE_OPEN, channel frames, DGRAM_BIND); (4) ITEM and CALL data, round-robin across streams; (5) emulated datagrams (§11.4).
  • On WebSocket the sender MUST apply this ordering when choosing the next frame to write. On WebTransport the classes are approximated by stream priorities (control, then lanes, then calls; §4.2): terminal frames on call streams share their stream’s priority, and only class 1, which travels on the control stream, keeps strict precedence.
  • Write batching: senders SHOULD flush when the queue drains rather than per frame, so that bursts of small frames are batched into one WebSocket message or QUIC packet without adding latency.

From the specification: §6.1, §6.2, §6.3, §6.4, §6.5, §6.6.