[Paginated Query] How to get the first elements in the "middle"
In order to achieve this, it makes sense to have a paginated query where messages are ordered by
_creationTime .Let's say a user is off for one week, have hundreds of missing messages, and open the chat. A common feature is to display the last seen message and then the new ones, and to scroll down until the most recent one.
Problem:
How do we do to "start" the paginated query so that it returns items started from the
LAST_MESSAGE_SEEN and can scroll up or down to load more?We could load of course all the messages until the
LAST_MESSAGE_SEEN , and scroll to it, but that wouldn't scale much if hundred of messages were not read, and wouldn't give the chat a snappy feeling.