public final class RealSubscriptionManager extends java.lang.Object implements SubscriptionManager
SubscriptionManager.Callback<T>| Constructor and Description |
|---|
RealSubscriptionManager(ScalarTypeAdapters scalarTypeAdapters,
SubscriptionTransport.Factory transportFactory,
java.util.Map<java.lang.String,java.lang.Object> connectionParams,
java.util.concurrent.Executor dispatcher,
long connectionHeartbeatTimeoutMs) |
| Modifier and Type | Method and Description |
|---|---|
void |
addOnStateChangeListener(com.apollographql.apollo.internal.subscription.RealSubscriptionManager.OnStateChangeListener onStateChangeListener) |
void |
removeOnStateChangeListener(com.apollographql.apollo.internal.subscription.RealSubscriptionManager.OnStateChangeListener onStateChangeListener) |
void |
start()
Set the
RealSubscriptionManager to 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) |
void |
unsubscribe(com.apollographql.apollo.api.Subscription subscription) |
public RealSubscriptionManager(@NotNull
ScalarTypeAdapters scalarTypeAdapters,
@NotNull
SubscriptionTransport.Factory transportFactory,
@NotNull
java.util.Map<java.lang.String,java.lang.Object> connectionParams,
@NotNull
java.util.concurrent.Executor dispatcher,
long connectionHeartbeatTimeoutMs)
public <T> void subscribe(@NotNull
com.apollographql.apollo.api.Subscription<?,T,?> subscription,
@NotNull
SubscriptionManager.Callback<T> callback)
subscribe in interface SubscriptionManagerpublic void unsubscribe(@NotNull
com.apollographql.apollo.api.Subscription subscription)
unsubscribe in interface SubscriptionManagerpublic void start()
RealSubscriptionManager to a connectible state. It is safe to call this method
at any time. Does nothing unless we are in the stopped state.start in interface SubscriptionManagerpublic void stop()
SubscriptionManager is stopping
because we check the state in #doSubscribe(Subscription, Callback). We pass true to
disconnect(boolean) because we want to disconnect even if, somehow, a new subscription
is added while or after we are doing the doUnsubscribe(Subscription) loop.stop in interface SubscriptionManagerpublic void addOnStateChangeListener(@NotNull
com.apollographql.apollo.internal.subscription.RealSubscriptionManager.OnStateChangeListener onStateChangeListener)
public void removeOnStateChangeListener(@NotNull
com.apollographql.apollo.internal.subscription.RealSubscriptionManager.OnStateChangeListener onStateChangeListener)