Readonly
actionThe action type of the message. This can be used to determine if the message was created, updated, or deleted.
Readonly
clientThe clientId of the user who created the message.
Readonly
createdThe timestamp at which the message was created.
Readonly
headersThe headers of a chat message. Headers enable attaching extra info to a message, which can be used for various features such as linking to a relative point in time of a livestream video or flagging this message as important or pinned.
Headers are part of the Ably realtime message extras.headers and they can be used for Filtered Subscriptions and similar.
This value is always set. If there are no headers, this is an empty object.
Do not use the headers for authoritative information. There is no server-side validation. When reading the headers, treat them like user input.
Readonly
metadataThe metadata of a chat message. Allows for attaching extra info to a message, which can be used for various features such as animations, effects, or simply to link it to other resources such as images, relative points in time, etc.
Metadata is part of the Ably Pub/sub message content and is not read by Ably.
This value is always set. If there is no metadata, this is an empty object.
Do not use metadata for authoritative information. There is no server-side validation. When reading the metadata treat it like user input.
Optional
Readonly
operationThe details of the operation that modified the message. This is only set for update and delete actions. It contains information about the operation: the clientId of the user who performed the operation, a description, and metadata.
Readonly
reactionsThe reactions summary for this message.
Readonly
serialThe unique identifier of the message.
Readonly
textThe text of the message.
Readonly
timestampThe timestamp at which this version was updated, deleted, or created.
Readonly
versionA unique identifier for the latest version of this message.
The timestamp at which the message was deleted.
The clientId of the user who deleted the message.
Indicates if the message has been deleted.
Indicates if the message has been updated.
The timestamp at which the message was updated.
The clientId of the user who updated the message.
Determines if this message was created after the given message. This comparison is based on global order, so does not necessarily represent the order that messages are received in realtime from the backend.
The message to compare against.
true if this message was created after the given message, in global order.
ErrorInfo if serials of either message is invalid.
Determines if this message was created before the given message. This comparison is based on global order, so does not necessarily represent the order that messages are received in realtime from the backend.
The message to compare against.
true if this message was created before the given message, in global order.
ErrorInfo if serials of either message is invalid.
Creates a copy of the message with fields replaced per the parameters.
Optional
params: MessageCopyParamsThe parameters to replace in the message.
The message copy.
Determines if this message is equal to the given message.
Note that this method compares messages based on Message.serial alone. It returns true if the two messages represent different versions of the same message.
The message to compare against.
true if the two messages are the same message.
Determines if this message is a newer version of the given message.
Note that negating this function does not mean that the message is an older version of the same message, as the two may be different messages entirely.
!message.isNewerVersionOf(other) !== message.isOlderVersionOf(other)
The message to compare against.
true if the two messages are the same message (isSameAs returns true) and this message is a newer version.
Determines if this message is an older version of the given message.
Note that negating this function does not mean that the message is a newer version of the same message, as the two may be different messages entirely.
!message.isOlderVersionOf(other) !== message.isNewerVersionOf(other)
The message to compare against.
true if the two messages are the same message (isSameAs returns true) and this message is an older version.
Determines if this message is the same version as the given message.
The message to compare against.
true if the two messages are the same message and have the same version.
Creates a new message instance with the event applied.
NOTE: This method will not replace the message reactions if the event is of type Message
.
The event to be applied to the returned message.
A new message instance with the event applied. If the event is a no-op, such as an event for an old version, the same message is returned (not a copy).
ErrorInfo if the event is for a different message.
ErrorInfo if the event is a ChatMessageEventType.Created.
Represents a single message in a chat room.