public class AblyRealtime extends AblyRest
AblyRest and provides additional realtime-specific features.
This class implements AutoCloseable so you can use it in
try-with-resources constructs and have the JDK close it for you.| Modifier and Type | Class and Description |
|---|---|
static interface |
AblyRealtime.Channels
A collection of Channels associated with this Ably Realtime instance.
|
| Modifier and Type | Field and Description |
|---|---|
AblyRealtime.Channels |
channels
A
AblyRealtime.Channels object. |
Connection |
connection
The
Connection object for this instance. |
| Constructor and Description |
|---|
AblyRealtime(ClientOptions options)
Constructs a RealtimeClient object using an Ably
ClientOptions object. |
AblyRealtime(java.lang.String key)
Constructs a Realtime client object using an Ably API key or token string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Calls
Connection.close() and causes the connection to close, entering the closing state. |
void |
connect()
Calls
Connection.connect() and causes the connection to open,
entering the connecting state. |
protected void |
onAuthError(ErrorInfo errorInfo)
Authentication error occurred
|
protected void |
onAuthUpdated(java.lang.String token,
boolean waitForResponse)
Authentication token has changed.
|
protected void |
onAuthUpdatedAsync(java.lang.String token,
Auth.AuthUpdateResult authUpdateResult)
Authentication token has changed.
|
onClientIdSet, publishBatch, publishBatch, publishBatchAsync, publishBatchAsync, request, requestAsync, stats, statsAsync, time, timeAsyncpublic final Connection connection
Connection object for this instance.
Spec: RTC2
public final AblyRealtime.Channels channels
AblyRealtime.Channels object.
Spec: RTC3, RTS1
public AblyRealtime(java.lang.String key)
throws AblyException
Spec: RSC1
key - The Ably API key or token string used to validate the client.AblyExceptionpublic AblyRealtime(ClientOptions options) throws AblyException
ClientOptions object.
Spec: RSC1
options - A ClientOptions object.AblyExceptionpublic void connect()
Connection.connect() and causes the connection to open,
entering the connecting state. Explicitly calling connect() is unnecessary
unless the ClientOptions.autoConnect property is disabled.
Spec: RTN11
public void close()
Connection.close() and causes the connection to close, entering the closing state.
Once closed, the library will not attempt to re-establish the connection
without an explicit call to Connection.connect().
Spec: RTN12
protected void onAuthUpdated(java.lang.String token,
boolean waitForResponse)
throws AblyException
onAuthUpdated in class AblyBasetoken - new tokenwaitForResponse - wait for server response before returning from methodAblyExceptionprotected void onAuthUpdatedAsync(java.lang.String token,
Auth.AuthUpdateResult authUpdateResult)
onAuthUpdatedAsync in class AblyBasetoken - new tokenauthUpdateResult - Callback resultprotected void onAuthError(ErrorInfo errorInfo)
onAuthError in class AblyBase