[Standards] MAM Sync Strategies
sam at samwhited.com
Mon Aug 9 11:46:45 UTC 2021
I started a PR against modernxmpp to document MAM sync strategies after
a discussion on jdev yesterday:
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.
More information about the Standards