Package io.ably.lib.types
Class PresenceMessage
java.lang.Object
io.ably.lib.types.BaseMessage
io.ably.lib.types.PresenceMessage
- All Implemented Interfaces:
Cloneable
A class representing an individual presence update to be sent or received
via the Ably Realtime service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Describes the possible actions members in the presence set can emit.static class
static class
-
Field Summary
FieldsFields inherited from class io.ably.lib.types.BaseMessage
clientId, connectionId, data, encoding, id, timestamp
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorPresenceMessage
(PresenceMessage.Action action, String clientId) Construct a PresenceMessage from an Action and clientIdPresenceMessage
(PresenceMessage.Action action, String clientId, Object data) Generic constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()
static PresenceMessage
fromEncoded
(com.google.gson.JsonObject messageJsonObject, ChannelOptions channelOptions) Decodes and decrypts a deserialized PresenceMessage-like object using the cipher inChannelOptions
.static PresenceMessage
fromEncoded
(String messageJson, ChannelOptions channelOptions) Decodes and decrypts a deserialized PresenceMessage-like object using the cipher inChannelOptions
.static PresenceMessage[]
fromEncodedArray
(com.google.gson.JsonArray presenceMsgArray, ChannelOptions channelOptions) Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher inChannelOptions
.static PresenceMessage[]
fromEncodedArray
(String presenceMsgArray, ChannelOptions channelOptions) Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher inChannelOptions
.Combines clientId and connectionId to ensure that multiple connected clients with an identical clientId are uniquely identifiable.toString()
Generate a String summary of this PresenceMessageMethods inherited from class io.ably.lib.types.BaseMessage
countFields, decode, decode, encode, getDetails, read, readInt, readLong, readString, toJsonObject
-
Field Details
-
action
The type ofPresenceMessage.Action
the PresenceMessage is for.Spec: TP3b
-
-
Constructor Details
-
PresenceMessage
public PresenceMessage()Default constructor -
PresenceMessage
Construct a PresenceMessage from an Action and clientId- Parameters:
-
action
- -
clientId
-
-
PresenceMessage
Generic constructor- Parameters:
-
action
- -
clientId
- -
data
-
-
-
Method Details
-
toString
Generate a String summary of this PresenceMessage -
clone
-
fromEncoded
public static PresenceMessage fromEncoded(com.google.gson.JsonObject messageJsonObject, ChannelOptions channelOptions) throws MessageDecodeException Decodes and decrypts a deserialized PresenceMessage-like object using the cipher inChannelOptions
. 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
- AChannelOptions
object containing the cipher. - Returns:
- A PresenceMessage object.
- Throws:
MessageDecodeException
-
fromEncoded
public static PresenceMessage fromEncoded(String messageJson, ChannelOptions channelOptions) throws MessageDecodeException Decodes and decrypts a deserialized PresenceMessage-like object using the cipher inChannelOptions
. 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
- AChannelOptions
object containing the cipher. - Returns:
- A PresenceMessage object.
- Throws:
MessageDecodeException
-
fromEncodedArray
public static PresenceMessage[] fromEncodedArray(com.google.gson.JsonArray presenceMsgArray, ChannelOptions channelOptions) throws MessageDecodeException Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher inChannelOptions
. 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
- AChannelOptions
object containing the cipher. - Returns:
- An array of PresenceMessage object.
- Throws:
MessageDecodeException
-
fromEncodedArray
public static PresenceMessage[] fromEncodedArray(String presenceMsgArray, ChannelOptions channelOptions) throws MessageDecodeException Decodes and decrypts an array of deserialized PresenceMessage-like object using the cipher inChannelOptions
. 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
- AChannelOptions
object containing the cipher. - Returns:
- An array of PresenceMessage object.
- Throws:
MessageDecodeException
-
memberKey
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.Spec: TP3h
- Returns:
- A combination of clientId and connectionId.
-