Class ConnectionManager

java.lang.Object
io.ably.lib.transport.ConnectionManager
All Implemented Interfaces:
ITransport.ConnectListener

public class ConnectionManager extends Object implements ITransport.ConnectListener
  • Field Details

    • msgSerial

      public long msgSerial
  • Constructor Details

  • Method Details

    • getStateErrorInfo

      public ErrorInfo getStateErrorInfo()
    • isActive

      public boolean isActive()
    • getHost

      public String getHost()
      host management
    • getConnectionState

      public ConnectionManager.State getConnectionState()
      states API
    • connect

      public void connect()
    • close

      public void close()
    • requestState

      public void requestState(ConnectionState state)
    • requestState

      public void requestState(ConnectionManager.StateIndication state)
    • ping

      public void ping(CompletionListener listener)
      ping API
    • onAuthUpdated

      public void onAuthUpdated(String token, boolean waitForResponse) throws AblyException
      (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

      public void onAuthUpdatedAsync(String token, Auth.AuthUpdateResult authUpdateResult)
      Async version of onAuthUpdated that returns a Future that includes an option Ably exception
    • onAuthError

      public void onAuthError(ErrorInfo errorInfo)
      Called when where was an error during authentication attempt
      Parameters:
      errorInfo - Error associated with unsuccessful authentication
    • onMessage

      public void onMessage(ITransport transport, ProtocolMessage message) throws AblyException
      React on message from the transport
      Parameters:
      transport - transport instance or null to bypass transport correctness check (for testing)
      message -
      Throws:
      AblyException
    • getPendingMessages

      public List<ConnectionManager.QueuedMessage> getPendingMessages()
    • onTransportAvailable

      public void onTransportAvailable(ITransport transport)
      Specified by:
      onTransportAvailable in interface ITransport.ConnectListener
    • onTransportUnavailable

      public void onTransportUnavailable(ITransport transport, ErrorInfo reason)
      Specified by:
      onTransportUnavailable in interface ITransport.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