A copy of SyncApi such that it can be used as a drop-in replacement for sync v2. For the actual sliding sync API, see sliding-sync.ts or the class SlidingSync.

Constructors

Properties

client: MatrixClient
failCount: number = 0
lastPos: null | string = null
notifEvents: MatrixEvent[] = []
slidingSync: SlidingSync
syncOpts: SyncApiOptions
syncState: null | SyncState = null
syncStateData?: SyncStateData

Methods

  • Takes a list of timelineEvents and adds and adds to notifEvents as appropriate. This must be called after the room the events belong to has been stored.

    Parameters

    • timelineEventList: MatrixEvent[]

      A list of timeline events. Lower index is earlier in time. Higher index is later.

    Returns void

  • Returns the additional data object associated with the current sync state, or null if there is no such data. Sync errors, if available, are put in the 'error' key of this object.

    Returns null | SyncStateData

  • Injects events into a room's model.

    Parameters

    • room: Room
    • stateEventList: MatrixEvent[]

      A list of state events. This is the state at the START of the timeline list if it is supplied.

    • Optional timelineEventList: MatrixEvent[]

      A list of timeline events. Lower index is earlier in time. Higher index is later.

    • Optional numLive: number

      the number of events in timelineEventList which just happened, supplied from the server.

    Returns Promise<void>

  • Peek into a room. This will result in the room in question being synced so it is accessible via getRooms(). Live updates for the room will be provided.

    Parameters

    • roomId: string

      The room ID to peek into.

    Returns Promise<Room>

    A promise which resolves once the room has been added to the store.

  • Purge any events in the notifEvents array. Used after a /sync has been complete. This should not be called at a per-room scope (e.g in onRoomData) because otherwise the ordering will be messed up e.g room A gets a bing, room B gets a newer bing, but both in the same /sync response. If we purge at a per-room scope then we could process room B before room A leading to room B appearing earlier in the notifications timeline, even though it has the higher origin_server_ts.

    Returns void

  • Specify the set_presence value to be used for subsequent calls to the Sync API.

    Parameters

    • Optional presence: SetPresence

      the presence to specify to set_presence of sync calls

    Returns void

  • Stop polling for updates in the peeked room. NOPs if there is no room being peeked.

    Returns void

  • Sets the sync state and emits an event to say so

    Parameters

    • newState: SyncState

      The new state string

    • Optional data: SyncStateData

      Object of additional data to emit in the event

    Returns void

Generated using TypeDoc