Frame reference
Every client and server frame of the Realtime API protocol, its tag and reply, and the fields of an event.
Frames travel in packets. Each frame is { corr, body }:
corr is your request ID, echoed on every reply. Use non-zero values for requests; unsolicited frames (live
deliveries, TokenExpiring, SubEnded, Flow) carry corr = 0.
Tags encode direction: 1–15 either way, 16–127 from clients, 128–255 from servers. No frame carries a segment ID; the segment comes only from the token.
Client frames
| Frame | Tag | Reply | Notes |
|---|---|---|---|
Ping { nonce, ts_ms } | 1 | Pong with the same nonce | Every heartbeat_ms |
Pong | 2 | none | |
Close { code, reason } | 3 | The connection closes | A polite goodbye |
Extension { code, content_type, data } | 4 | OpError { UnsupportedFeature } | None are enabled yet |
Hello | 16 | Welcome or Close | First frame; WebSocket only |
Reauth { token } | 17 | OpOk, after any SubEnded, or Close | Token refresh |
Publish | 32 | PubAck, OpError, or nothing (NoAck, signals) | |
Subscribe | 33 | [Gap] SubAck [Deliver… / Snapshot…] or OpError | WebSocket only |
Unsubscribe { topic | topic_id } | 34 | OpOk | WebSocket only; always succeeds |
CursorAck { acks } | 35 | none | A flow-control hint |
Poll | 36 | … PollEnd | HTTP only |
Server frames
| Frame | Tag | When |
|---|---|---|
Ping / Pong | 1 / 2 | Pong answers your Ping |
Close { code, reason, retry_after_ms } | 3 | Before the server closes the connection |
Welcome | 128 | The answer to Hello |
TokenExpiring { expires_at_ms } | 129 | 60 seconds before the token expires |
OpOk | 144 | Success with nothing to report |
OpError { code, message, retry_after_ms, topic_id } | 145 | One request failed; the connection stays open |
PubAck { topic_id, level, epoch, seq, duplicate, server_ts_ms, uid } | 146 | A publish receipt |
SubAck { topic_id, delivery, catching_up, oldest, latest, snapshot_follows, deliveries, state_latest } | 147 | A subscription is confirmed; links the name to topic_id |
Gap { topic_id, reason, requested, oldest, latest, resumed } | 148 | A cursor couldn't be honoured |
Flow { action, retry_after_ms, topic_id } | 149 | Outbound pressure: Throttle, Pause or Resume publishing |
PollEnd { timed_out, more } | 150 | The last frame of a poll |
Deliver { topic_id, delivery, replayed, events } | 176 | Events from one topic |
Snapshot { topic_id, snapshot_id, chunk, last_chunk, fence, events } | 177 | Current KV values and signals |
SubEnded { topic_id, code, message } | 178 | The server ended a subscription |
ServerPacket also carries server_time_ms, set when the packet holds signal expiry data, so clients can work out
a signal's remaining lifetime from the server's clock.
Event
The events inside Deliver and Snapshot:
| Field | Meaning |
|---|---|
topic_id | The topic |
epoch, seq | The cursor. seq is 0 for KV and signal events in a topic that carries several types |
uid | The permanent ID of a stream or KV event |
name | The event name |
delivery | The event's type: Durable, LastValue or Ephemeral |
publisher | The sender's verified identity |
key, tombstone | KV and signals: which value, and whether it was deleted |
payload, content_type, headers | As published |
server_ts_ms | When the server accepted it; for display, not ordering |
client_ts_ms | The sender's own clock |
version | The state version of a KV or signal event in a topic with several types; 0 otherwise |
expires_at_ms | Signals: the absolute expiry time. 0 means not set; the maximum value means no expiry |
topic_id values are stable while a topic exists. A recreated topic gets a new one, so after a reconnect subscribe
by name and use the ID from SubAck.
Enums
| Enum | Values |
|---|---|
| Delivery | Unspecified 0, Durable 1 (stream), LastValue 2 (kv), Ephemeral 3 (signal) |
| Start | Latest 0, Oldest 1, After 2, LastN 3 |
| On gap | FromOldest 0, FromLatest 1, Fail 2 |
| Gap reason | Unspecified 0, Expired 1, EpochLost 2 |
| Ack | Default 0, NoAck 1, Accepted 2, Committed 3 |
| Flow action | Resume 0, Pause 1, Throttle 2 |
The full schema is protocol.fbs.