[Standards] MAM Sync Strategies

Sam Whited sam at samwhited.com
Mon Aug 9 11:46:45 UTC 2021


Hi all,

I started a PR against modernxmpp to document MAM sync strategies after
a discussion on jdev yesterday:

https://github.com/modernxmpp/modernxmpp/pull/41

I wondered if anyone would share what their sync strategy is (or even
possibly add it to that PR) so that we can document a few clients and
maybe move towards an XEP that outlines one or two ideal ones?

I'll start with the one I described in the chat yesterday that's used
(experimentally) by Mellium/Communiqué:

On client start iterate through all items in the roster. If no messages
exist in the local archive: Query in reverse order (in case the server
breaks it up by page and we end up committing pages separately) with
before: now && limit: X (where X is some configurable number, what we
think will fit on the page with some margin, etc.). Otherwise query with
after-id: <last message> (making sure that the last message was pulled
from the DB before we send initial presence).

If the user scrolls to the top of the history, query in reverse order
with before-id: <first message>. Fetch the next page for as long as they
continue to scroll up.

Thanks,
Sam

-- 
Sam Whited


More information about the Standards mailing list