Class AblyRealtime

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class AblyRealtime
    extends AblyRest
    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.
    • Constructor Detail

      • AblyRealtime

        public AblyRealtime​(java.lang.String key)
                     throws AblyException
        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
    • Method Detail

      • connect

        public void connect()
        Calls Connection.connect() and causes the connection to open, entering the connecting state. Explicitly calling connect() is unnecessary unless the ClientOptions.autoConnect property is disabled.

        Spec: RTN11

      • close

        public void close()
        Calls Connection.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 to Connection.connect().

        Spec: RTN12

        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class AblyBase
      • onAuthUpdated

        protected void onAuthUpdated​(java.lang.String token,
                                     boolean waitForResponse)
                              throws AblyException
        Authentication token has changed.
        Overrides:
        onAuthUpdated in class AblyBase
        Parameters:
        token - new token
        waitForResponse - wait for server response before returning from method
        Throws:
        AblyException
      • onAuthUpdatedAsync

        protected void onAuthUpdatedAsync​(java.lang.String token,
                                          Auth.AuthUpdateResult authUpdateResult)
        Authentication token has changed. Async version
        Overrides:
        onAuthUpdatedAsync in class AblyBase
        Parameters:
        token - new token
        authUpdateResult - Callback result
      • onAuthError

        protected void onAuthError​(ErrorInfo errorInfo)
        Authentication error occurred
        Overrides:
        onAuthError in class AblyBase