SlidingSync is a high-level data structure which controls the majority of sliding sync. It has no hooks into JS SDK except for needing a MatrixClient to perform the HTTP request. This means this class (and everything it uses) can be used in isolation from JS SDK if needed. To hook this up with the JS SDK, you need to use SlidingSyncSdk.

Hierarchy

Constructors

Properties

abortController?: AbortController
client: MatrixClient

The client to use for /sync calls.

confirmedRoomSubscriptions: Set<string> = ...
desiredRoomSubscriptions: Set<string> = ...
extensions: Record<string, Extension> = {}
listModifiedCount: number = 0
lists: SlidingList[]
needsResend: boolean = false
pendingReq?: Promise<MSC3575SlidingSyncResponse>
proxyBaseUrl: string

The base URL of the sliding sync proxy

roomSubscriptionInfo: MSC3575RoomSubscription

The params to use for room subscriptions.

terminated: boolean = false
timeoutMS: number

The number of milliseconds to wait for a response.

txnId: null | string = null
txnIdDefers: (IDeferred<string> & {
    txnId: string;
})[] = []

Methods

  • Parameters

    • listIndex: number
    • index: number

    Returns void

  • Parameters

    • isInitial: boolean

    Returns object

  • Get the full list parameters for a list index. This function is provided for callers to use in conjunction with setList to update fields on an existing list.

    Returns

    A copy of the list or undefined.

    Parameters

    • index: number

      The list index to get the list for.

    Returns null | MSC3575List

  • Get the room data for a list.

    Returns

    The list data which contains the rooms in this list

    Parameters

    • index: number

      The list index

    Returns null | {
        joinedCount: number;
        roomIndexToRoomId: Record<number, string>;
    }

  • Get the room subscriptions for the sync API.

    Returns

    A copy of the desired room subscriptions.

    Returns Set<string>

  • Invoke all attached room data listeners.

    Parameters

    • roomId: string

      The room which received some data.

    • roomData: MSC3575RoomData

      The raw sliding sync response JSON.

    Returns void

  • Get the length of the sliding lists.

    Returns

    The number of lists in the sync request

    Returns number

  • Modify which events to retrieve for room subscriptions. Invalidates all room subscriptions such that they will be sent up afresh.

    Returns

    A promise which resolves to the transaction ID when it has been received down sync (or rejects with the transaction ID if the action was not applied e.g the request was cancelled immediately after sending, in which case the action will be applied in the subsequent request)

    Parameters

    Returns Promise<string>

  • Modify the room subscriptions for the sync API. Calling this function will interrupt the /sync request to resend new subscriptions. If the /sync stream has not started, this will prepare the room subscriptions for when start() is called.

    Returns

    A promise which resolves to the transaction ID when it has been received down sync (or rejects with the transaction ID if the action was not applied e.g the request was cancelled immediately after sending, in which case the action will be applied in the subsequent request)

    Parameters

    • s: Set<string>

      The new desired room subscriptions.

    Returns Promise<string>

  • Parameters

    • ext: object

    Returns void

  • Parameters

    • listIndex: number
    • index: number

    Returns void

  • Resend a Sliding Sync request. Used when something has changed in the request. Resolves with the transaction ID of this request on success. Rejects with the transaction ID of this request on failure.

    Returns Promise<string>

  • Re-setup this connection e.g in the event of an expired session.

    Returns void

  • Parameters

    • Optional txnId: string

    Returns void

  • Add or replace a list. Calling this function will interrupt the /sync request to resend new lists.

    Returns

    A promise which resolves to the transaction ID when it has been received down sync (or rejects with the transaction ID if the action was not applied e.g the request was cancelled immediately after sending, in which case the action will be applied in the subsequent request)

    Parameters

    • index: number

      The index to modify

    • list: MSC3575List

      The new list parameters.

    Returns Promise<string>

  • Set new ranges for an existing list. Calling this function when only the ranges have changed is more efficient than calling setList(index,list) as this function won't resend sticky params, whereas setList always will.

    Returns

    A promise which resolves to the transaction ID when it has been received down sync (or rejects with the transaction ID if the action was not applied e.g the request was cancelled immediately after sending, in which case the action will be applied in the subsequent request)

    Parameters

    • index: number

      The list index to modify

    • ranges: number[][]

      The new ranges to apply.

    Returns Promise<string>

  • Parameters

    • listIndex: number
    • hi: number
    • low: number

    Returns void

  • Parameters

    • listIndex: number
    • hi: number
    • low: number

    Returns void

  • Start syncing with the server. Blocks until stopped.

    Returns Promise<void>

Generated using TypeDoc