Skip to content

Do you have to manually unsubscribe from subscriptions? #2200

Answered by kitten
SteveMelons asked this question in Q&A
Discussion options

You must be logged in to vote

No, like with queries, as soon as your component unmounts the subscription will be terminated/cancelled.
It's important to note that the pattern described in the "Architecture" section of the docs applies to all operations: https://formidable.com/open-source/urql/docs/architecture/#requests-and-operations-on-the-client
(With mutations being the only "special" operation)

So, as long as you use the bindings, this will all be taken care of for you.

However, Websockets connections themselves may be a different topic. Depending on how your WebSockets/Subscriptions client is implemented, urql only "forwards" operations to it, as described on the Subscriptions page, so managing the WebSockets/Su…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SteveMelons
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants