I have setup a Apollo Server and Client with Subscriptions. Everything works as expected in basic setup. I am using Apollo Client's Subscribe method for subscription. Something like below:
graphqlClient.subscribe({ query, variables }).subscribe({
next: d => {
onData(d);
},
error: error => {
handleErrorResponse(error).catch(e => {
Logger.notifyError(new Error(`Real-time update error | ${e.message}.`));
});
}
});
This works and I can see my onData callback firing on events.
Question - In our application, the Subscription filter is dynamic and user can select different values which will impact the filter. I have gone through documentation and many (many) articles but could not find a way to update filters or how to handle this use case?
Expectation - Once user selects any value and apply filter, I want to update my subscription on server to start using new filters?