vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

Apollo subscriptions-transport-ws support in GraphiQL

Open UglyHobbitFeet opened this issue 5 years ago • 10 comments

This issue still occurs in 3.8.2. I am getting a 500 Internal error and the output window of GraphiQL says: 'SyntaxError: Unexpected token I in JSON at position 0'

Originally posted by @UglyHobbitFeet in https://github.com/vert-x3/vertx-web/issues/1334#issuecomment-539567924

UglyHobbitFeet avatar Oct 08 '19 15:10 UglyHobbitFeet

I have checked our test suite and subscription examples. They look good to me. I believe this is because GraphiQL is not configured to use the Apollo WS transport for subscriptions.

I'll add it to the backlog.

tsegismont avatar Oct 09 '19 09:10 tsegismont

There's a GraphiQL fetcher hat supports GraphQL-Subscriptions with the subscriptions-transport-ws package. But it works only with an old version of the transport and the project is now archived.

So we need help from the community to create a replacement for the GraphiQL fetcher that works with the recent version.

As a workaround, you can test subcriptions with the Apollo Playground.

tsegismont avatar Oct 09 '19 15:10 tsegismont

ok good to know, thanks.

UglyHobbitFeet avatar Oct 09 '19 15:10 UglyHobbitFeet

Hi @tsegismont I'm not sure if there's something that I can help with .. but I'm definitely interested in seeing this feature supported. Apparently, according to their documentation, the current version of graphiql (1.4.2) fully supports subscriptions. I have most saturday mornings available - is it worth me hacking with vertx-web and graphiql (1.4.2) to see if I can get it to work? Or am I missing something really fundamental? Thanks.

dazraf avatar May 29 '21 14:05 dazraf

Hi @dazraf . Thank you for offering your help!

When this issue was filed, GraphiQL already supported subscriptions (parsing queries and displaying data), but the problem was to have a fetcher that implemented the transport (here's the fetcher setup https://github.com/vert-x3/vertx-web/blob/master/vertx-web-graphql/vertx-web-graphiql/src/index.js#L60-L75)

Do you know if now they provide data fetcher that supports it? In this case, resolving the issue would be a matter of upgrading our version of GraphiQL.

tsegismont avatar May 31 '21 08:05 tsegismont

Hi @tsegismont I worked through graphiql for a while before then trying out graphql-playground. Works beautifully with no change in the websocket protocol. I also read that playground and graphiql will be merging. Playground has all the same features, slightly prettier UI and appears to be a better long term investment. Would you like a PR for it?

dazraf avatar Jun 06 '21 15:06 dazraf

Correction: I read this blog article and it looks like GraphiQL will become the core of a future playground (as a preset). https://graphql.org/blog/2020-04-03-web-based-graphql-ides-for-the-win

dazraf avatar Jun 07 '21 04:06 dazraf

Hi @dazraf . I have used Playground myself, as a desktop app. It worked well with Vert.x Web GraphQL. I liked the fact I wasn't forced into shipping an IDE as part of the app code. Perhaps that's why we didn't have requests to include it so far.

But if you'd like to send a PR, please go ahead

tsegismont avatar Jun 07 '21 08:06 tsegismont

That's interesting ... I found it basically the same functionality as GraphiQL, but with prettier UX. But then, I took a look and it does look large at ~ 2.3MB. Much larger than graphiql's 872K! Will continue to have a look at means of using GraphiQL if you prefer.

Btw, my test repo is here: https://github.com/dazraf/vertx-graphql-blockchain. It currently embeds the UI as they've described, using links to their CDN, in a top-level index.html page. I love using GraphQL with vertx. Thank you to all the contributors for this feature!

dazraf avatar Jun 07 '21 15:06 dazraf

But then, I took a look and it does look large at ~ 2.3MB. Much larger than graphiql's 872K!

The price of nice UI perhaps ;-)

Seriously, if GraphiQL and Playground are to merge eventually, I would prefer that we wait for the first merged version to be released and then support it.

In the meantime, an updated GraphiQL version would be great!

And thanks for your kind words!

tsegismont avatar Jun 08 '21 16:06 tsegismont

Hi @UglyHobbitFeet @dazraf , I know it's been a while, but if you're still interested, I would appreciate any feedback on #2346

tsegismont avatar Jan 27 '23 13:01 tsegismont

Hi! Sorry, but I no longer use this product, so I wouldn't be able to test. Thanks.

On Fri, Jan 27, 2023 at 8:38 AM Thomas Segismont @.***> wrote:

Hi @UglyHobbitFeet https://github.com/UglyHobbitFeet @dazraf https://github.com/dazraf , I know it's been a while, but if you're still interested, I would appreciate any feedback on #2346 https://github.com/vert-x3/vertx-web/pull/2346

— Reply to this email directly, view it on GitHub https://github.com/vert-x3/vertx-web/issues/1415#issuecomment-1406521736, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBDS7QHLRU55HNHOGWVEGTWUPFURANCNFSM4I6TKE3Q . You are receiving this because you were mentioned.Message ID: @.***>

UglyHobbitFeet avatar Jan 27 '23 14:01 UglyHobbitFeet

@UglyHobbitFeet no worries, thanks for letting me know. Cheers

tsegismont avatar Jan 27 '23 17:01 tsegismont