Package 

Class Message

  • 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 class Message.Batch

      Sets the channel names and message contents to publishBatch.

      public class Message.Serializer
    • Method Summary

      Modifier and Type Method Description
      String toString() Generate a String summary of this Message
      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.
      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.
      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.
      • Methods inherited from class io.ably.lib.types.BaseMessage

        decode, decode, encode, getDetails, toJsonObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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

      • toString

         String toString()

        Generate a String summary of this Message

      • 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.