How to unsubscribe a subscription using graphql-ws with apollo client #132
-
I'm setting up the websocket client following client usage with Apollo. And I'm trying to use Apollo's subscribeToMore functionality, like the following:
However, calling unsubscribe doesn't seem to send the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey there, the const unsubscribe = client.subscribe(
{
query: 'subscription { greetings }',
},
{
next: onNext,
error: onError,
complete: onComplete,
},
);
// calling `unsubscribe` will send a `Complete` message for the subscription
unsubscribe(); Regarding your question about |
Beta Was this translation helpful? Give feedback.
Hey there, the
Complete
message is sent when the subscription is done with. You dont explicitly send the message, youunsubscribe
from a subscription.Regarding your question about
subscribeToMore
- I actually have no idea about its inner workings (and I also have 0 experience with the Apollo stack), I am sorry, but I cannot be of any help there. 😬