A client wants to connect, synchronize and have a chat history without holes starting from a client-defined event.
This is the anticipated flow:
- connect, authenticate, bind
- client: fetch everything(*) from MAM
- this can be based on a start date (e.g. last 2 days) or the last known archive ID.
- (*) After completing this, the client will know the latest MAM-ID from that fetch (
last_id
), but maybe some messages arrived in between
- client: send a MAM-Subscription request containing the
last_id
- server: atomically do the following
- mark all offline messages that were in MAM as delivered (e.g. if MAM was set to "roster")
- send out all remaining offline messages
- send out all messages that arrived after
last_id
- enable live messages + Carbons for this session ("sent" Carbons from other resources; "received" without the
<forwarded/>
wrapper) - enable MAM-ID reflection for all messages sent by the client that are persisted in MAM
- client: send presence broadcast