public interface SubscriptionManager
Modifier and Type | Interface and Description |
---|---|
static interface |
SubscriptionManager.Callback<T> |
Modifier and Type | Method and Description |
---|---|
void |
addOnStateChangeListener(OnSubscriptionManagerStateChangeListener onStateChangeListener)
Adds new listener for subscription manager state changes.
|
SubscriptionManagerState |
getState()
Returns the current state of subscription manager.
|
void |
removeOnStateChangeListener(OnSubscriptionManagerStateChangeListener onStateChangeListener)
Removes listener for subscription manager state changes.
|
void |
start()
Put the
SubscriptionManager in a connectible state. |
void |
stop()
Unsubscribe from all active subscriptions, and disconnect the web socket.
|
<T> void |
subscribe(com.apollographql.apollo.api.Subscription<?,T,?> subscription,
SubscriptionManager.Callback<T> callback)
Starts provided subscription.
|
void |
unsubscribe(com.apollographql.apollo.api.Subscription<?,?,?> subscription)
Stops provided subscription.
|
<T> void subscribe(@NotNull com.apollographql.apollo.api.Subscription<?,T,?> subscription, @NotNull SubscriptionManager.Callback<T> callback)
T
- subscription
- to startcallback
- to be called on resultvoid unsubscribe(@NotNull com.apollographql.apollo.api.Subscription<?,?,?> subscription)
subscription
- to stopSubscriptionManagerState getState()
void addOnStateChangeListener(@NotNull OnSubscriptionManagerStateChangeListener onStateChangeListener)
onStateChangeListener
- to be called when state changedvoid removeOnStateChangeListener(@NotNull OnSubscriptionManagerStateChangeListener onStateChangeListener)
onStateChangeListener
- to removevoid start()
SubscriptionManager
in a connectible state. Does not necessarily open a web
socket.void stop()