-
Notifications
You must be signed in to change notification settings - Fork 536
Support graphql-ws client for GraphiQL IDE #739
Conversation
hey this is awesome! just wanted to point out that this is in the works as well: we were hoping to publish this library alongside GraphiQL, and then here we can use that utility to generate the fetcher as well. what do you think? |
That will be perfect! Note the apollographql/GraphiQL-Subscriptions-Fetcher is already archived and doesn't work for https://github.com/enisdenjo/graphql-ws, so to have a generic and up-to-dated fetcher will be great! |
@junminstorage to be honest, it should never have ended up in this repo. i had asked someone to use the subsriptions fetcher as prior art to build something new and they installed the package instead, haha! oops! |
@acao I looked at your great work on @graphiql/create-fetcher in graphql/graphiql#1770, it seems you are very close to finish line. It is big PR, do you have any ETA? I wonder if it is worth creating a dedicated PR for fetcher related changes. |
@junminstorage hey thank you! i hope to finish it by tomorrow |
@junminstorage forgot to update you, you should be good to pull in |
@achao I run into issue with the Also another question, you provide https://github.com/graphql/graphiql/blob/main/packages/graphiql-toolkit/docs/create-fetcher.md#wsclient option for developer to inject graphql-ws client dependency, could you provide another option for developer to inject subscriptions-transport-ws as well. This allows graphiql/toolkit not tied to any particular versions of both clients. |
it was a matter of significant debate to even get we are about to publish it under |
|
@acao all changes are ready! |
replaced by #755 |
To follow up #687 and continue to address #390, I drafted this PR to
Questions:
1. There is no umd version of graphql parser, e.g. graphql-tag publish a umd parser but it has dependency on graphql itself. I use a simple regex to check if the graphQLParams contains subscription operation. Options:- wait for graphql/graphiql#1770 to finish so we can use its umd fetcher which supports both ws clients
- create umd fetcher or graphql parser in this repo.
2. developer provides
websocketClient
as part ofgraphiql
option, its values are "v0" for subscriptions-transport-ws, "v1" for graphql-ws, I did this based on graphile/crystal#1338, open to better naming suggestion.Specifically check out this tutorial script about how to start web socket server to support subscription using enisdenjo/graphql-ws : https://github.com/junminstorage/graphql-tutorial/blob/master/src/index_v1.js