Interface SubscriptionManager
-
- All Known Implementing Classes:
RealSubscriptionManager
public interface SubscriptionManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSubscriptionManager.Callback<T>
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddOnStateChangeListener(OnSubscriptionManagerStateChangeListener onStateChangeListener)Adds new listener for subscription manager state changes.SubscriptionManagerStategetState()Returns the current state of subscription manager.voidreconnect()Reconnect the web socket.voidremoveOnStateChangeListener(OnSubscriptionManagerStateChangeListener onStateChangeListener)Removes listener for subscription manager state changes.voidstart()Put theSubscriptionManagerin a connectible state.voidstop()Unsubscribe from all active subscriptions, and disconnect the web socket.<T> voidsubscribe(com.apollographql.apollo.api.Subscription<?,T,?> subscription, SubscriptionManager.Callback<T> callback)Starts provided subscription.voidunsubscribe(com.apollographql.apollo.api.Subscription<?,?,?> subscription)Stops provided subscription.
-
-
-
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 startcallback- 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 theSubscriptionManagerin 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.
-
-