If a client reconnects after a brief disconnection (say, about 30 seconds), real-time messages that they missed should be replayed. Currently, the messages are gone forever.
- The client needs to distinguish between "connect" (no replay) and "reconnect" (replay).
- The server needs to understand replay requests (possibly with a "replay" command).
- The server needs to buffer messages for the maximum replay duration (e.g., last 30 seconds of activity or last 4096 messages, whichever is fewer).
- The client needs to gracefully handle receiving duplicate messages.
Advanced features might include:
- Let the "replay" command include a time window, so clients which know they have been disconnected for only 4 seconds only need to replay the last 4 seconds of activity.