-
- All Implemented Interfaces:
-
java.lang.Cloneable
public class Message extends BaseMessage
Contains an individual message that is sent to, or received from, Ably.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMessage.BatchSets the channel names and message contents to publishBatch.
public classMessage.Serializer
-
Field Summary
Fields Modifier and Type Field Description public Stringnamepublic MessageExtrasextraspublic StringconnectionKeypublic Stringserialpublic MessageVersionversionpublic MessageActionactionpublic MessageAnnotationsannotations
-
Constructor Summary
Constructors Constructor Description Message()Default constructor Message(String name, Object data)Construct a Message object with an event name and payload. Message(String name, Object data, String clientId)Construct a Message object with an event name, payload, and a unique client ID. Message(String name, Object data, MessageExtras extras)Construct a Message object with an event name, payload, and a extras. Message(String name, Object data, String clientId, MessageExtras extras)Construct a Message object with an event name, payload, extras, and a unique client ID.
-
Method Summary
Modifier and Type Method Description StringtoString()Generate a String summary of this Message static MessagefromEncoded(JsonObject messageJson, ChannelOptions channelOptions)A static factory method to create a Message object from a deserialized Message-like object encoded using Ably's wire protocol. static MessagefromEncoded(String messageJson, ChannelOptions channelOptions)A static factory method to create a Message object from a deserialized Message-like object encoded using Ably's wire protocol. static Array<Message>fromEncodedArray(JsonArray messageArray, ChannelOptions channelOptions)A static factory method to create an array of Message objects from an array of deserializedMessage-like object encoded using Ably's wire protocol. static Array<Message>fromEncodedArray(String messagesArray, ChannelOptions channelOptions)A static factory method to create an array of Message objects from an array of deserializedMessage-like object encoded using Ably's wire protocol. -
-
Constructor Detail
-
Message
Message()
Default constructor
-
Message
Message(String name, Object data)
Construct a Message object with an event name and payload.- Parameters:
name- The event name.data- The message payload.
-
Message
Message(String name, Object data, String clientId)
Construct a Message object with an event name, payload, and a unique client ID.- Parameters:
name- The event name.data- The message payload.clientId- The client ID of the publisher of this message.
-
Message
Message(String name, Object data, MessageExtras extras)
Construct a Message object with an event name, payload, and a extras.- Parameters:
name- The event name.data- The message payload.extras- Extra information to be sent with this message.
-
Message
Message(String name, Object data, String clientId, MessageExtras extras)
Construct a Message object with an event name, payload, extras, and a unique client ID.- Parameters:
name- The event name.data- The message payload.clientId- The client ID of the publisher of this message.extras- Extra information to be sent with this message.
-
-
Method Detail
-
fromEncoded
static Message fromEncoded(JsonObject messageJson, ChannelOptions channelOptions)
A static factory method to create a Message object from a deserialized Message-like object encoded using Ably's wire protocol.
Spec: TM3
- Parameters:
messageJson- A Message-like deserialized object.channelOptions- A ChannelOptions object.If you have an encrypted channel, use this to allow the library to decrypt the data.
-
fromEncoded
static Message fromEncoded(String messageJson, ChannelOptions channelOptions)
A static factory method to create a Message object from a deserialized Message-like object encoded using Ably's wire protocol.
Spec: TM3
- Parameters:
messageJson- A Message-like deserialized object.channelOptions- A ChannelOptions object.If you have an encrypted channel, use this to allow the library to decrypt the data.
-
fromEncodedArray
static Array<Message> fromEncodedArray(JsonArray messageArray, ChannelOptions channelOptions)
A static factory method to create an array of Message objects from an array of deserializedMessage-like object encoded using Ably's wire protocol.
Spec: TM3
- Parameters:
messageArray- An array of Message-like deserialized objects.channelOptions- A ChannelOptions object.If you have an encrypted channel, use this to allow the library to decrypt the data.
-
fromEncodedArray
static Array<Message> fromEncodedArray(String messagesArray, ChannelOptions channelOptions)
A static factory method to create an array of Message objects from an array of deserializedMessage-like object encoded using Ably's wire protocol.
Spec: TM3
- Parameters:
messagesArray- An array of Message-like deserialized objects.channelOptions- A ChannelOptions object.If you have an encrypted channel, use this to allow the library to decrypt the data.
-
-
-
-