Skip to main content

sync_events_route

Function sync_events_route 

Source
pub(crate) async fn sync_events_route(
    __arg0: State<State>,
    __arg1: ClientIp,
    body: Args<Request>,
) -> Result<Response>
Expand description

§GET /_matrix/client/r0/sync

Synchronize the client’s state with the latest state on the server.

  • This endpoint takes a since parameter which should be the next_batch value from a previous request for incremental syncs.

Calling this endpoint without a since parameter returns:

  • Some of the most recent events of each timeline
  • Notification counts for each room
  • Joined and invited member counts, heroes
  • All state events

Calling this endpoint with a since parameter from a previous next_batch returns: For joined rooms:

  • Some of the most recent events of each timeline that happened after since
  • If user joined the room after since: All state events (unless lazy loading is activated) and all device list updates in that room
  • If the user was already in the room: A list of all events that are in the state now, but were not in the state at since
  • If the state we send contains a member event: Joined and invited member counts, heroes
  • Device list updates that happened after since
  • If there are events in the timeline we send or the user send updated his read mark: Notification counts
  • EDUs that are active now (read receipts, typing updates, presence)
  • TODO: Allow multiple sync streams to support Pantalaimon

For invited rooms:

  • If the user was invited after since: A subset of the state of the room at the point of the invite

For left rooms:

  • If the user left after since: prev_batch token, empty state (TODO: subset of the state at the point of the leave)