GraphiQL-Subscriptions-Fetcher icon indicating copy to clipboard operation
GraphiQL-Subscriptions-Fetcher copied to clipboard

Subscription Client API changed

Open joaomlap opened this issue 6 years ago • 1 comments

I was trying to use GraphiQL Subscriptions Fetcher and I realised that the API for the Subscriptions Transport WS had changed.

So now they deprecated the subscribe function and instead give a request one that returns an observable. My solution is this:

subscription = subscriptionsClient.request({
  query: graphQLParams.query,
  variables: graphQLParams.variables,
});

observable = subscription.subscribe((result, err) => {
  if (err) {
    observer.error(err);
  } else {
    observer.next(result);
  }
});

And to unsubscribe you just do observable.unsubscribe().

Currently I can not open a PR, but feel free to use my code or even help me improve it.

joaomlap avatar Sep 27 '18 10:09 joaomlap

when will be fixed?

akaSybe avatar Feb 07 '19 00:02 akaSybe