Building real-time features that recover
Why WebSockets and push notifications should signal state changes—not become the only copy of state.
Clients could reconnect, resynchronize, and tolerate missed events
The misconception
A real-time transport makes delivery immediate when connected, but it cannot guarantee that every device receives every event exactly once and in order.
The recovery model
Messages became notifications that authoritative state had changed.
- Reconnect with bounded backoff
- Restore subscriptions after reconnect
- Track versions or event identifiers
- Resynchronize authoritative state after gaps
- Re-check authorization when handling actions
What I learned
A reliable real-time feature is defined less by never disconnecting and more by recovering predictably from delay, duplication, reordering, and missed events.