Interface SubscriptionManager

    • Method Detail

      • subscribe

        <T> void subscribe​(@NotNull
                           com.apollographql.apollo.api.Subscription<?,​T,​?> subscription,
                           @NotNull
                           SubscriptionManager.Callback<T> callback)
        Starts provided subscription. Establishes connection to the subscription server if it was previously disconnected.
        Type Parameters:
        T -
        Parameters:
        subscription - to start
        callback - to be called on result
      • unsubscribe

        void unsubscribe​(@NotNull
                         com.apollographql.apollo.api.Subscription<?,​?,​?> subscription)
        Stops provided subscription. If there are no active subscriptions left, disconnects from the subscription server.
        Parameters:
        subscription - to stop
      • getState

        SubscriptionManagerState getState()
        Returns the current state of subscription manager.
        Returns:
        current state
      • addOnStateChangeListener

        void addOnStateChangeListener​(@NotNull
                                      OnSubscriptionManagerStateChangeListener onStateChangeListener)
        Adds new listener for subscription manager state changes.
        Parameters:
        onStateChangeListener - to be called when state changed
      • removeOnStateChangeListener

        void removeOnStateChangeListener​(@NotNull
                                         OnSubscriptionManagerStateChangeListener onStateChangeListener)
        Removes listener for subscription manager state changes.
        Parameters:
        onStateChangeListener - to remove
      • start

        void start()
        Put the SubscriptionManager in a connectible state. Does not necessarily open a web socket.
      • stop

        void stop()
        Unsubscribe from all active subscriptions, and disconnect the web socket.
      • reconnect

        void reconnect()
        Reconnect the web socket. Use this together with SubscriptionConnectionParamsProvider if you need to update connectionParams.