Package io.ably.lib.realtime
Class AblyRealtime
java.lang.Object
io.ably.lib.rest.AblyBase
io.ably.lib.rest.AblyRest
io.ably.lib.realtime.AblyRealtime
- All Implemented Interfaces:
 AutoCloseable
A client that extends the functionality of the 
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.- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA collection of Channels associated with this Ably Realtime instance. - 
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AblyRealtime.ChannelsAAblyRealtime.Channelsobject.final ConnectionTheConnectionobject for this instance. - 
Constructor Summary
ConstructorsConstructorDescriptionAblyRealtime(ClientOptions options) Constructs a RealtimeClient object using an AblyClientOptionsobject.AblyRealtime(String key) Constructs a Realtime client object using an Ably API key or token string. - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()CallsConnection.close()and causes the connection to close, entering the closing state.voidconnect()CallsConnection.connect()and causes the connection to open, entering the connecting state.protected voidonAuthError(ErrorInfo errorInfo) Authentication error occurredprotected voidonAuthUpdated(String token, boolean waitForResponse) Authentication token has changed.protected voidonAuthUpdatedAsync(String token, Auth.AuthUpdateResult authUpdateResult) Authentication token has changed.protected voidsetChannelSerialsFromRecoverOption(Map<String, String> serials) Methods inherited from class io.ably.lib.rest.AblyBase
onClientIdSet, publishBatch, publishBatch, publishBatchAsync, publishBatchAsync, request, requestAsync, stats, statsAsync, time, timeAsync 
- 
Field Details
- 
connection
TheConnectionobject for this instance.Spec: RTC2
 - 
channels
AAblyRealtime.Channelsobject.Spec: RTC3, RTS1
 
 - 
 - 
Constructor Details
- 
AblyRealtime
Constructs a Realtime client object using an Ably API key or token string.Spec: RSC1
- Parameters:
 - 
key- The Ably API key or token string used to validate the client. - Throws:
 AblyException
 - 
AblyRealtime
Constructs a RealtimeClient object using an AblyClientOptionsobject.Spec: RSC1
- Parameters:
 - 
options- AClientOptionsobject. - Throws:
 AblyException
 
 - 
 - 
Method Details
- 
connect
public void connect()CallsConnection.connect()and causes the connection to open, entering the connecting state. Explicitly calling connect() is unnecessary unless theClientOptions.autoConnectproperty is disabled.Spec: RTN11
 - 
close
public void close()CallsConnection.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 toConnection.connect().Spec: RTN12
- Specified by:
 - 
closein interfaceAutoCloseable - Overrides:
 - 
closein classAblyBase 
 - 
onAuthUpdated
Authentication token has changed.- Overrides:
 - 
onAuthUpdatedin classAblyBase - Parameters:
 - 
token- new token - 
waitForResponse- wait for server response before returning from method - Throws:
 AblyException
 - 
onAuthUpdatedAsync
Authentication token has changed. Async version- Overrides:
 - 
onAuthUpdatedAsyncin classAblyBase - Parameters:
 - 
token- new token - 
authUpdateResult- Callback result 
 - 
onAuthError
Authentication error occurred- Overrides:
 - 
onAuthErrorin classAblyBase 
 - 
setChannelSerialsFromRecoverOption
 - 
getChannelSerials
 
 -