public class ConnectionManager extends java.lang.Object implements ITransport.ConnectListener
| Modifier and Type | Class and Description |
|---|---|
class |
ConnectionManager.ConnectionWaiter
a class that listens for state change
events for in-place authorization
|
static class |
ConnectionManager.QueuedMessage
event queueing
|
static class |
ConnectionManager.StateIndication
a class encapsulating information
associated with a state change
request or notification
|
static class |
ConnectionManager.StateInfo
a class encapsulating state machine
information for a given state
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.HashMap<ConnectionState,ConnectionManager.StateInfo> |
states
all state information
|
| Constructor and Description |
|---|
ConnectionManager(AblyRealtime ably,
Connection connection)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkConnectivity()
Determine whether or not the client has connection to the network
without reference to a specific ably host.
|
void |
close() |
void |
connect()
state management
|
ConnectionManager.StateInfo |
getConnectionState() |
java.lang.String |
getHost()
host management
|
ErrorInfo |
getStateErrorInfo() |
boolean |
isActive() |
void |
onAuthError(ErrorInfo errorInfo)
Called when where was an error during authentication attempt
|
void |
onAuthUpdated(java.lang.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 |
onMessage(ITransport transport,
ProtocolMessage message)
React on message from the transport
|
void |
onTransportAvailable(ITransport transport,
ITransport.TransportParams params) |
void |
onTransportUnavailable(ITransport transport,
ITransport.TransportParams params,
ErrorInfo reason) |
void |
ping(CompletionListener listener) |
void |
requestState(ConnectionManager.StateIndication state) |
void |
requestState(ConnectionState state) |
void |
send(ProtocolMessage msg,
boolean queueEvents,
CompletionListener listener) |
protected void |
setLastActivity(long lastActivityTime) |
public static final java.util.HashMap<ConnectionState,ConnectionManager.StateInfo> states
public ConnectionManager(AblyRealtime ably, Connection connection)
public ErrorInfo getStateErrorInfo()
public boolean isActive()
public java.lang.String getHost()
public void connect()
public void close()
public ConnectionManager.StateInfo getConnectionState()
public void requestState(ConnectionState state)
public void requestState(ConnectionManager.StateIndication state)
public void ping(CompletionListener listener)
public void onAuthUpdated(java.lang.String token,
boolean waitForResponse)
throws AblyException
AblyExceptionpublic void onAuthError(ErrorInfo errorInfo)
errorInfo - Error associated with unsuccessful authenticationpublic void onMessage(ITransport transport, ProtocolMessage message) throws AblyException
transport - transport instance or null to bypass transport correctness check (for testing)message - AblyExceptionpublic void onTransportAvailable(ITransport transport, ITransport.TransportParams params)
onTransportAvailable in interface ITransport.ConnectListenerpublic void onTransportUnavailable(ITransport transport, ITransport.TransportParams params, ErrorInfo reason)
onTransportUnavailable in interface ITransport.ConnectListenerprotected boolean checkConnectivity()
protected void setLastActivity(long lastActivityTime)
public void send(ProtocolMessage msg, boolean queueEvents, CompletionListener listener) throws AblyException
AblyException