Package io.ably.lib.transport
Class ConnectionManager
java.lang.Object
io.ably.lib.transport.ConnectionManager
- All Implemented Interfaces:
 ITransport.ConnectListener
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceMethods on the channels map owned by theAblyRealtimeinstance which theConnectionManagerneeds access to.static classevent queueingclassa class encapsulating state machine information for a given statestatic classa class encapsulating information associated with a currentState change request or notification - 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionConnectionManager(AblyRealtime ably, Connection connection, ConnectionManager.Channels channels, PlatformAgentProvider platformAgentProvider, LiveObjectsPlugin liveObjectsPlugin) ConnectionManager - 
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDetermine whether or not the client has connection to the network without reference to a specific ably host.voidclose()voidconnect()states APIgetHost()host managementbooleanisActive()voidonAuthError(ErrorInfo errorInfo) Called when where was an error during authentication attemptvoidonAuthUpdated(String token, boolean waitForResponse) (RTC8) For a realtime client, Auth.authorize instructs the library to obtain a token using the provided tokenParams and authOptions and upgrade the current connection to use that token; or if not currently connected, to connect with the token.voidonAuthUpdatedAsync(String token, Auth.AuthUpdateResult authUpdateResult) Async version of onAuthUpdated that returns a Future that includes an option Ably exceptionvoidonMessage(ITransport transport, ProtocolMessage message) React on message from the transportvoidonTransportAvailable(ITransport transport) voidonTransportUnavailable(ITransport transport, ErrorInfo reason) voidping(CompletionListener listener) ping APIvoidrequestState(ConnectionState state) voidvoidsend(ProtocolMessage msg, boolean queueEvents, CompletionListener listener) protected voidsetLastActivity(long lastActivityTime)  
- 
Field Details
- 
msgSerial
public long msgSerial - 
maxMessageSize
public int maxMessageSize 
 - 
 - 
Constructor Details
- 
ConnectionManager
public ConnectionManager(AblyRealtime ably, Connection connection, ConnectionManager.Channels channels, PlatformAgentProvider platformAgentProvider, LiveObjectsPlugin liveObjectsPlugin) throws AblyException ConnectionManager- Throws:
 AblyException
 
 - 
 - 
Method Details
- 
getStateErrorInfo
 - 
isActive
public boolean isActive() - 
getHost
host management - 
getConnectionState
states API - 
connect
public void connect() - 
close
public void close() - 
requestState
 - 
requestState
 - 
ping
ping API - 
onAuthUpdated
(RTC8) For a realtime client, Auth.authorize instructs the library to obtain a token using the provided tokenParams and authOptions and upgrade the current connection to use that token; or if not currently connected, to connect with the token.- Throws:
 AblyException
 - 
onAuthUpdatedAsync
Async version of onAuthUpdated that returns a Future that includes an option Ably exception - 
onAuthError
Called when where was an error during authentication attempt- Parameters:
 - 
errorInfo- Error associated with unsuccessful authentication 
 - 
onMessage
React on message from the transport- Parameters:
 - 
transport- transport instance or null to bypass transport correctness check (for testing) - 
message- - Throws:
 AblyException
 - 
getPendingMessages
 - 
onTransportAvailable
- Specified by:
 - 
onTransportAvailablein interfaceITransport.ConnectListener 
 - 
checkConnectivity
protected boolean checkConnectivity()Determine whether or not the client has connection to the network without reference to a specific ably host. This is to determine whether it is better to try a fallback host, or keep retrying with the default host.- Returns:
 - boolean, true if network is available
 
 - 
setLastActivity
protected void setLastActivity(long lastActivityTime)  - 
send
public void send(ProtocolMessage msg, boolean queueEvents, CompletionListener listener) throws AblyException - Throws:
 AblyException
 
 -