public class BaseMessage
extends java.lang.Object
implements java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
clientId
The client ID of the publisher of this message.
|
java.lang.String |
connectionId
The connection ID of the publisher of this message.
|
java.lang.Object |
data
The message payload, if provided.
|
java.lang.String |
encoding
This is typically empty, as all messages received from Ably are automatically decoded client-side using this value.
|
java.lang.String |
id
A Unique ID assigned by Ably to this message.
|
long |
timestamp
Timestamp of when the message was received by Ably, as milliseconds since the Unix epoch.
|
| Constructor and Description |
|---|
BaseMessage() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
countFields() |
void |
decode(ChannelOptions opts) |
void |
decode(ChannelOptions opts,
DecodingContext context) |
void |
encode(ChannelOptions opts) |
void |
getDetails(java.lang.StringBuilder builder)
Generate a String summary of this BaseMessage.
|
protected void |
read(com.google.gson.JsonObject map)
Populate fields from JSON.
|
protected java.lang.Long |
readLong(com.google.gson.JsonObject map,
java.lang.String key)
Read an optional numerical value.
|
protected java.lang.String |
readString(com.google.gson.JsonObject map,
java.lang.String key)
Read an optional textual value.
|
static com.google.gson.JsonObject |
toJsonObject(BaseMessage message)
Base for gson serialisers.
|
public java.lang.String id
Spec: TM2a
public long timestamp
Spec: TM2f
public java.lang.String clientId
Spec: RSL1g1, TM2b
public java.lang.String connectionId
Spec: TM2c
public java.lang.String encoding
Spec: TM2e
public java.lang.Object data
Spec: TM2d
public void getDetails(java.lang.StringBuilder builder)
public void decode(ChannelOptions opts) throws MessageDecodeException
MessageDecodeExceptionpublic void decode(ChannelOptions opts, DecodingContext context) throws MessageDecodeException
MessageDecodeExceptionpublic void encode(ChannelOptions opts) throws AblyException
AblyExceptionpublic static com.google.gson.JsonObject toJsonObject(BaseMessage message)
protected void read(com.google.gson.JsonObject map)
throws MessageDecodeException
MessageDecodeExceptionprotected java.lang.String readString(com.google.gson.JsonObject map,
java.lang.String key)
java.lang.ClassCastException - if an element exists for that key and that element is not a JsonPrimitive
or is not a valid string value.protected java.lang.Long readLong(com.google.gson.JsonObject map,
java.lang.String key)
java.lang.ClassCastException - if an element exists for that key and that element is not a JsonPrimitive
or is not a valid long value.protected int countFields()