Normal reconnect
- Upgrade
wss://api.relayapp.im/v1/websocketwith the bearer header. - Read
acked_throughfromready. - Deduplicate replayed events by
event_id. - Commit events in sequence order.
- Cumulatively ACK the highest committed sequence.
event_id makes that replay safe: every replay retains the same event_id.
When Relay requires FULL sync
If the saved checkpoint falls outside the 30-day delivery retention window,ready.full_sync_required is true. Relay then sends:
1
Pause normal ACKs
Do not ACK event sequences while
full_sync_required is true.2
Read authoritative state
Page through
GET /v1/chats, then read visible history with
GET /v1/chats/{chatId}/messages.3
Rebuild durably
Commit the recovered Chat, Message, membership, reaction, and receipt
state before continuing.
4
Complete the boundary
Send the exact
through_sequence from the full_sync frame.Commit the snapshot
Treat the REST reads as one recovery unit. Do not replace the durable inbox until every Chat page and every Message page has been read successfully.full_sync_mismatch. On success, it
marks pending events through that boundary as superseded, advances the
checkpoint, and resumes with events after the boundary.
Completing recovery also confirms durable acceptance of recovered inbound
Messages and can advance their Delivered state.
Events during sync
Relay continues assigning sequences while recovery runs. Thethrough_sequence freezes the boundary covered by the snapshot; after
completion Relay sends newer pending events normally. Deduplicate state that
appeared in both the snapshot and a later event.
Retention
Relay stores terminal WebSocket rows in PostgreSQL for 30 days. Acknowledged, path-transferred, and superseded rows are then pruned. PostHog receives derived analytics only and is never the delivery system of record.Failure handling
Do not sendfull_sync_complete if any page is missing, a cursor repeats, or
the durable snapshot fails to commit. Fix the read or storage failure and
reconnect. A false completion permanently advances the agent checkpoint past
events the backend did not recover.

