Skip to content

How should clients order a timeline composed of events from multiple rooms? #1520

@robintown

Description

@robintown

Suggestion
It's come up in Element Web that we want to present timelines which aggregate the contents of multiple rooms, or in other words, 'overlay' the events from one room on top of another. To do this, the client needs to be able to establish an order between events from different rooms. The question is, how?

A few options come to mind:

  • Interleave the overlay events into the timeline based on their origin_server_ts. Different servers can have very different clocks though, and events in /messages responses certainly don't have to be in chronological order, so origin_server_ts is neither accurate to the local homeserver's view, nor monotonically increasing. For simple use cases involving only one homeserver, this will do the job, but in all other cases it's approximate at best and can result in the overlay events jumping around as the user scrolls back through history.
  • Use the age field on events to calculate a timestamp relative to the client's local clock, and interleave based on that metric. I don't entirely understand how homeservers calculate age, but I'd guess this approach is only marginally better than origin_server_ts, if at all.
  • If /messages were changed to use stream ordering (which apparently means "the order in which events arrive at the server"), then servers could include a timestamp in each event's unsigned data indicating when it received the event, which I believe would give us an accurate, monotonically increasing measure to sort by. It requires spec changes, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementAn idea/future MSC for the spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions