Skip to content

override subscription query once .subscription initiated #416

Answered by enisdenjo
luisweir asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a way to override the actual payload of the subscription query AFTER initialising the client?

Once a subscription query establishes a subscription, it cannot change. You have to complete the subscription and create a new one with new arguments.

The connectionParams are, and can only be, issued once per connection. If you want to change them, you have to reconnect and provide new params during the connect.

On the other hand, if you want to access the connectionParams when subscribing, you can simply create a global variable currentConnectionParams, assign it always on connect and access it when you need it.

...
connectionParams: async() => {
    const params = 
+   this.currentC…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@luisweir
Comment options

Answer selected by enisdenjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants