Skip to content

Instantly share code, notes, and snippets.

@ge0rg
Created September 19, 2019 16:43
Show Gist options
  • Save ge0rg/5ae3365196a0c046fc596bbf707fdc15 to your computer and use it in GitHub Desktop.
Save ge0rg/5ae3365196a0c046fc596bbf707fdc15 to your computer and use it in GitHub Desktop.
XMPP MAM Subcsription, no need for Bind 2.0

MAM Subscription

A client wants to connect, synchronize and have a chat history without holes starting from a client-defined event.

This is the anticipated flow:

  1. connect, authenticate, bind
  2. 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
  3. client: send a MAM-Subscription request containing the last_id
  4. 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
  5. client: send presence broadcast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment