Messages
Attributes
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, Binary (ASCII-8BIT String), Hash, Array
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: Hash, Array
id
A Unique ID assigned by Ably to this message.
Type: String
client_id
The client ID of the publisher of this message.
Type: String
connection_id
The connection ID of the publisher of this message.
Type: String
connection_key
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 a Time object.
Type: Time
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
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
| Parameter | Description | Type |
|---|---|---|
| encodedMsg | A Message-like deserialized object. | Object |
| channelOptions | An optional ChannelOptions. If you have an encrypted channel, use this to allow the library to 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
| Parameter | Description | Type |
|---|---|---|
| encodedMsgs | An array of Message-like deserialized objects. | Array |
| channelOptions | An optional ChannelOptions. If you have an encrypted channel, use this to allow the library to decrypt the data. | Object |
Returns
An Array of Message objects
MessageAnnotations
Attributes
| Property | Description | Type |
|---|---|---|
| summary | An object whose keys are annotation types, and the values are aggregated summaries for that annotation type | Record<String, JsonObject> |
MessageVersion
Attributes
| Property | Description | Type |
|---|---|---|
| serial | An Ably-generated ID that uniquely identifies this version of the message. Can be compared lexicographically to determine version ordering. For an original message with an action of message.create, this will be equal to the top-level serial. | String |
| timestamp | The time this version was created (when the update or delete operation was performed). For an original message, this will be equal to the top-level timestamp. | Time |
| clientId | The client identifier of the user who performed the update or delete operation. Only present for message.update and message.delete actions. | String (optional) |
| description | Optional description provided when the update or delete was performed. Only present for message.update and message.delete actions. | String (optional) |
| metadata | Optional metadata provided when the update or delete was performed. Only present for message.update and message.delete actions. | Object (optional) |