Class AblyRealtime

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class AblyRealtime
    extends AblyRest
    implements java.lang.AutoCloseable
    AblyRealtime The top-level class to be instanced for the Ably Realtime library. 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
        Instance the Ably library using a key only. This is simply a convenience constructor for the simplest case of instancing the library with a key for basic authentication and no other options.
        Parameters:
        key - ; String key (obtained from application dashboard)
        Throws:
        AblyException
    • Method Detail

      • close

        public void close()
        Close this instance. This closes the connection. The connection can be re-opened by calling Connection.connect().
        Specified by:
        close in interface java.lang.AutoCloseable
      • 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
      • onAuthError

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