Your first WebSocket session
The goal is an accepted subscription and a durably saved checkpoint. Start with arranged access. The address and credentials below are synthetic templates; replace them with values permitted for your integration.
1. Open WSS and read hello
Validate version, connectionId, streamId, historyGeneration, scope and limits. Begin checking contiguous frameSequence values at "1". The complete shape is in frames.
2. Authenticate
Send this template before hello.limits.authTimeoutMs expires:
The placeholder is not a working key. There is no authenticated frame in v1. Send the subscription within subscribeTimeoutMs.
3. Subscribe
This is a complete subscribe template. Confirm the allowed stages before using it.
live_cut explicitly starts at a new cut. An existing consumer recovering its saved state uses resume instead.
4. Save the response boundary
An accepted subscription produces subscribed with its generation and binding. Matching batches precede checkpoints; caught_up marks the fixed cut. A quiet wallet can have no matching batches and still reach a checkpoint.
Apply all effects through the checkpoint and save dedup state and the full token in one durable local transaction. Only after commit send ACK. This complete ACK template uses synthetic values: replace the token, connection ID and generation with the current server values.
5. Prepare for a disconnect
Resume from the last locally committed token, even if its ACK was lost. A received batch or an ACK log entry is not your durable boundary. Handle a failed resume explicitly rather than silently choosing a new live cut.
Continue with processing, recovery and the durable consumer pseudocode.
