Contains an individual presence update sent to, or received from, Ably.

Hierarchy

  • PresenceMessage

Constructors

Properties

The type of PresenceAction the PresenceMessage is for.

clientId: string

The ID of the client that published the PresenceMessage.

connectionId: string

The ID of the connection associated with the client that published the PresenceMessage.

data: any

The payload of the PresenceMessage.

encoding: string

This will typically be empty as all presence messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the data payload.

extras: any

A JSON object of arbitrary key-value pairs that may contain metadata, and/or ancillary payloads. Valid payloads include headers.

id: string

A unique ID assigned to each PresenceMessage by Ably.

timestamp: number

The time the PresenceMessage was received by Ably, as milliseconds since the Unix epoch.

fromEncoded: ((JsonObject: any, channelOptions?: ChannelOptions) => PresenceMessage)

Type declaration

    • (JsonObject: any, channelOptions?: ChannelOptions): PresenceMessage
    • Decodes and decrypts a deserialized PresenceMessage-like object using the cipher in ChannelOptions. Any residual transforms that cannot be decoded or decrypted will be in the encoding property. Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue) to avoid having to parse the encoding string.

      Parameters

      • JsonObject: any

        The deserialized PresenceMessage-like object to decode and decrypt.

      • Optional channelOptions: ChannelOptions

        A ChannelOptions object containing the cipher.

      Returns PresenceMessage

fromEncodedArray: ((JsonArray: any[], channelOptions?: ChannelOptions) => PresenceMessage[])

Type declaration

    • (JsonArray: any[], channelOptions?: ChannelOptions): PresenceMessage[]
    • Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher in ChannelOptions. Any residual transforms that cannot be decoded or decrypted will be in the encoding property. Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue) to avoid having to parse the encoding string.

      Parameters

      • JsonArray: any[]

        An array of deserialized PresenceMessage-like objects to decode and decrypt.

      • Optional channelOptions: ChannelOptions

        A ChannelOptions object containing the cipher.

      Returns PresenceMessage[]

Generated using TypeDoc