L3 sequence numbers
Everydelta message carries a monotonically increasing sequence number scoped to the subscribed market. After you receive a snapshot at sequence N, you should expect deltas at N+1, N+2, and so on.
When your connection lags or the server detects an internal gap, it sends a resync_required message and clears the subscription. You must resubscribe to get back in sync.
Gap detection
Your client should track the last seen sequence number and check each incoming delta:resync_required and drops the subscription server-side.
The resync_required message
The server sendsresync_required in two situations:
- Sequence gap — the server observed that a delta it delivered did not match the expected sequence for your connection.
- Receiver lag — your connection fell behind the broadcast buffer and messages were skipped.
expected_sequence and current_sequence tell you how far behind you fell. The reason field contains a human-readable description.
Recovery flow
When you receiveresync_required for the l3 channel:
Discard local book state
Clear your in-memory order book for the affected market. Do not apply any further deltas for that market until after you receive the new snapshot.
Resubscribe
Send a fresh The server will respond with a new
subscribe message for the market:snapshot.Rebuild from the snapshot
Replace your local book with the contents of the snapshot. Record its
sequence number as your new baseline.The last_sequence field
Thesubscribe message accepts a last_sequence field:
null or omit the field — the behavior is identical.
Server-side triggers
The server sendsresync_required in two code paths:
| Trigger | Description |
|---|---|
| Sequence gap | The delta delivered to your connection has a sequence number that does not equal last_seen + 1. The subscription is cleared immediately. |
| Receiver lag | Your connection’s broadcast channel buffer overflowed. The server skipped messages to catch up and cannot deliver the missed deltas. |
resync_required message.
Reconnection strategy
On a clean disconnect or any unrecoverable error, treat the new connection as a fresh session:Resubscribe
Send a
subscribe message for each market you want to track. You will receive a fresh snapshot for each.After a backend restart, all market-data sequence numbers reset to
0. Clients should always re-bootstrap from a fresh snapshot and not assume their previous sequence baseline is still valid.