Package io.ably.lib.transport
Class ConnectionManager
java.lang.Object
io.ably.lib.transport.ConnectionManager
- All Implemented Interfaces:
ITransport.ConnectListener
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Methods on the channels map owned by theAblyRealtime
instance which theConnectionManager
needs access to.static class
event queueingclass
a class encapsulating state machine information for a given statestatic class
a class encapsulating information associated with a currentState change request or notification -
Field Summary
-
Constructor Summary
ConstructorDescriptionConnectionManager
(AblyRealtime ably, Connection connection, ConnectionManager.Channels channels, PlatformAgentProvider platformAgentProvider) ConnectionManager -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Determine whether or not the client has connection to the network without reference to a specific ably host.void
close()
void
connect()
states APIgetHost()
host managementboolean
isActive()
void
onAuthError
(ErrorInfo errorInfo) Called when where was an error during authentication attemptvoid
onAuthUpdated
(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.void
onAuthUpdatedAsync
(String token, Auth.AuthUpdateResult authUpdateResult) Async version of onAuthUpdated that returns a Future that includes an option Ably exceptionvoid
onMessage
(ITransport transport, ProtocolMessage message) React on message from the transportvoid
onTransportAvailable
(ITransport transport) void
onTransportUnavailable
(ITransport transport, ErrorInfo reason) void
ping
(CompletionListener listener) ping APIvoid
requestState
(ConnectionState state) void
void
send
(ProtocolMessage msg, boolean queueEvents, CompletionListener listener) protected void
setLastActivity
(long lastActivityTime)
-
Field Details
-
msgSerial
public long msgSerial
-
-
Constructor Details
-
ConnectionManager
public ConnectionManager(AblyRealtime ably, Connection connection, ConnectionManager.Channels channels, PlatformAgentProvider platformAgentProvider) 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:
-
onTransportAvailable
in 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
-