Messages

Properties

A Message represents an individual message that is sent to or received from Ably.

name

The event name, if provided.
Type: String

data

The message payload, if provided.
Type: String, StringBuffer, JSON Object

extras

Metadata and/or ancillary payloads, if provided. Valid payloads include push, headers (a map of strings to strings for arbitrary customer-supplied metadata), ephemeral, and privileged.
Type: JSON Object

id

A Unique ID assigned by Ably to this message.
Type: String

clientId

The client ID of the publisher of this message.
Type: String

connectionId

The connection ID of the publisher of this message.
Type: String

connectionKey

A connection key, which can optionally be included for a REST publish as part of the publishing on behalf of a realtime client functionality.
Type: String

timestamp

Timestamp when the message was first received by the Ably, as milliseconds since the epoch.
Type: Integer

encoding

This will typically be empty as all 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.
Type: String

action

The action type of the message, one of the MessageAction enum values.
Type: int enum { MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, META, MESSAGE_SUMMARY }

serial

A server-assigned identifier that will be the same in all future updates of this message. It can be used to add annotations to a message. Serial will only be set if you enable annotations in channel rules.
Type: String

annotations

An object containing information about annotations that have been made to the object.
Type: MessageAnnotations

Message constructors

Message.fromEncoded

Message.fromEncoded(Object encodedMsg, ChannelOptions channelOptions?) -> Message

A static factory method to create a Message from a deserialized Message-like object encoded using Ably's wire protocol.

Parameters
ParameterDescriptionType
encodedMsgA Message-like deserialized object.Object
channelOptionsAn optional ChannelOptions. If you have an encrypted channel, use this to allow the library can decrypt the data.Object
Returns

A Message object

Message.fromEncodedArray

Message.fromEncodedArray(Object[] encodedMsgs, ChannelOptions channelOptions?) -> Message[]

A static factory method to create an array of Messages from an array of deserialized Message-like object encoded using Ably's wire protocol.

Parameters
ParameterDescriptionType
encodedMsgsAn array of Message-like deserialized objects.Array
channelOptionsAn optional ChannelOptions. If you have an encrypted channel, use this to allow the library can decrypt the data.Object
Returns

An Array of Message objects

MessageAnnotations

Properties

PropertyDescriptionType
summaryAn object whose keys are annotation types, and the values are aggregated summaries for that annotation typeRecord<String, JsonObject>
Select...