API Design · Senior · Question 52 of 75
How should a real-time API recover from disconnects without losing events?
- ✓Correct answer: Give events sequence IDs; clients reconnect with the last ID seen (SSE's
Last-Event-ID) and the server replays missed events from a buffer - 2Clients should reload the whole app
- 3Events lost during disconnects are acceptable in all cases
Explanation
If the buffer doesn't reach back far enough, tell the client to do a full resync.