Interface RealtimePresence

Enables the presence set to be entered and subscribed to, and the historic presence set to be retrieved for a channel.

Hierarchy

  • RealtimePresence

Properties

syncComplete: boolean

Indicates whether the presence set synchronization between Ably and the clients on the channel has been completed. Set to true when the sync is complete.

Methods

  • Enters the presence set for the channel, optionally passing a data payload. A clientId is required to be present on a channel.

    Parameters

    • Optional data: any

      The payload associated with the presence member.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Enters the presence set of the channel for a given clientId. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard clientId.

    Parameters

    • clientId: string

      The ID of the client to enter into the presence set.

    • Optional data: any

      The payload associated with the presence member.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Retrieves the current members present on the channel and the metadata for each member, such as their PresenceAction and ID. Returns an array of PresenceMessage objects.

    Parameters

    • Optional params: RealtimePresenceParams

      A set of parameters which are used to specify which presence members should be retrieved.

    Returns Promise<PresenceMessage[]>

    A promise which, upon success, will be fulfilled with an array of PresenceMessage objects. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Retrieves a PaginatedResult object, containing an array of historical PresenceMessage objects for the channel. If the channel is configured to persist messages, then presence messages can be retrieved from history for up to 72 hours in the past. If not, presence messages can only be retrieved from history for up to two minutes in the past.

    Parameters

    • Optional params: RealtimeHistoryParams

      A set of parameters which are used to specify which presence messages should be retrieved.

    Returns Promise<PaginatedResult<PresenceMessage>>

    A promise which, upon success, will be fulfilled with a PaginatedResult object containing an array of PresenceMessage objects. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Leaves the presence set for the channel. A client must have previously entered the presence set before they can leave it.

    Parameters

    • Optional data: any

      The payload associated with the presence member.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Leaves the presence set of the channel for a given clientId. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard clientId.

    Parameters

    • clientId: string

      The ID of the client to leave the presence set for.

    • Optional data: any

      The payload associated with the presence member.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Updates the data payload for a presence member. If called before entering the presence set, this is treated as an ENTER event.

    Parameters

    • Optional data: any

      The payload to update for the presence member.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Updates the data payload for a presence member using a given clientId. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard clientId.

    Parameters

    • clientId: string

      The ID of the client to update in the presence set.

    • Optional data: any

      The payload to update for the presence member.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

Generated using TypeDoc