-
- All Implemented Interfaces:
-
java.lang.Cloneable
public class PresenceMessage extends BaseMessage implements Cloneable
A class representing an individual presence update to be sent or received via the Ably Realtime service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumPresenceMessage.ActionDescribes the possible actions members in the presence set can emit.
public classPresenceMessage.ActionSerializerpublic classPresenceMessage.Serializer
-
Field Summary
Fields Modifier and Type Field Description public PresenceMessage.Actionaction
-
Constructor Summary
Constructors Constructor Description PresenceMessage()Default constructor PresenceMessage(PresenceMessage.Action action, String clientId)Construct a PresenceMessage from an Action and clientId PresenceMessage(PresenceMessage.Action action, String clientId, Object data)Generic constructor
-
Method Summary
Modifier and Type Method Description StringtoString()Generate a String summary of this PresenceMessage Objectclone()static PresenceMessagefromEncoded(JsonObject messageJsonObject, ChannelOptions channelOptions)Decodes and decrypts a deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string. static PresenceMessagefromEncoded(String messageJson, ChannelOptions channelOptions)Decodes and decrypts a deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string. static Array<PresenceMessage>fromEncodedArray(JsonArray presenceMsgArray, ChannelOptions channelOptions)Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string. static Array<PresenceMessage>fromEncodedArray(String presenceMsgArray, ChannelOptions channelOptions)Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string. StringmemberKey()Combines clientId and connectionId to ensure that multiple connected clients with an identical clientId are uniquely identifiable.A string function that returns the combined clientId and connectionId. -
-
Constructor Detail
-
PresenceMessage
PresenceMessage()
Default constructor
-
PresenceMessage
PresenceMessage(PresenceMessage.Action action, String clientId)
Construct a PresenceMessage from an Action and clientId
-
PresenceMessage
PresenceMessage(PresenceMessage.Action action, String clientId, Object data)
Generic constructor
-
-
Method Detail
-
fromEncoded
static PresenceMessage fromEncoded(JsonObject messageJsonObject, ChannelOptions channelOptions)
Decodes and decrypts a deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string.
Spec: TP4
- Parameters:
messageJsonObject- The deserialized PresenceMessage-like object to decode and decrypt.channelOptions- A ChannelOptions object containing the cipher.
-
fromEncoded
static PresenceMessage fromEncoded(String messageJson, ChannelOptions channelOptions)
Decodes and decrypts a deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string.
Spec: TP4
- Parameters:
messageJson- The deserialized PresenceMessage-like object to decode and decrypt.channelOptions- A ChannelOptions object containing the cipher.
-
fromEncodedArray
static Array<PresenceMessage> fromEncodedArray(JsonArray presenceMsgArray, ChannelOptions channelOptions)
Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string.
Spec: TP4
- Parameters:
presenceMsgArray- An array of deserialized PresenceMessage-like objects to decode and decrypt.channelOptions- A ChannelOptions object containing the cipher.
-
fromEncodedArray
static Array<PresenceMessage> fromEncodedArray(String presenceMsgArray, ChannelOptions channelOptions)
Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher in ChannelOptions.Any residual transforms that cannot be decoded or decrypted will be in the encoding property.Intended for users receiving messages from a source other than a REST or Realtime channel (for example a queue)to avoid having to parse the encoding string.
Spec: TP4
- Parameters:
presenceMsgArray- An array of deserialized PresenceMessage-like objects to decode and decrypt.channelOptions- A ChannelOptions object containing the cipher.
-
-
-
-