Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Support graphql-ws #812

Open
bostandyksoft opened this issue Apr 26, 2022 · 5 comments
Open

Support graphql-ws #812

bostandyksoft opened this issue Apr 26, 2022 · 5 comments

Comments

@bostandyksoft
Copy link

Hi.

I tried to use this library with JS client. All tutorials about it said, that need use "graphql-ws" library for subscriptions. But all worked examples of servers with this library used "subscriptions-transport-ws".

NPM install for this JS-library says

The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.co
m/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md

So I have question - I there is a way to switch library WebSocket support to graphql-ws either - do you have plan to support it?

I've added my client. To checking it on your own project, you can change parts of code under //TODO
dist.zip

Best regards. Alexey

@bostandyksoft
Copy link
Author

I've notice, that subscriptions are broken since 12.0.0 version. For version 11.0.0 all is good

@oliemansm
Copy link
Member

Do you have spring-boot-starter-websocket in your dependencies? In 11.0.0 it would automatically pull in all sorts of spring boot starters, while in 12.0.0 it relies on you to add the proper dependencies. Then the kickstart starter will only enable features depending on things that are on the classpath. Meaning if you do not have a websocket starter on your classpath it will not configure support for subscriptions.

In gradle it would be:

implementation 'org.springframework.boot:spring-boot-starter-websocket:2.6.7'

@bostandyksoft
Copy link
Author

Thanks for quick response. This fixes second notice. But apollo client, based on graphql-ws still not working.

@oliemansm
Copy link
Member

There should be some documentation on the Apollo repo on how to migrate from subscriptions-transport-ws to graphql-ws. The underlying protocol should still be the same, it's just a matter of how to set it up on the client side that's changed. Support for that is out of scope of this project.

@KammererTob
Copy link

KammererTob commented Apr 29, 2022

The underlying protocol is not the same i think, mainly because GraphQL did not define it in any spec (see here: https://www.apollographql.com/docs/react/data/subscriptions/#choosing-a-subscription-library). graphql-ws besides also supporting the subscription operation, allows to use GraphQL over WS entirely (unless i misunderstood something). More discussion here: graphql/graphql-over-http#140.
I am not sure if this is matured enough already to warrant any work. Although with Apollo already having this implemented it is probably somewhat safe to say that it will stay.
This is the new protocol: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
The correct repo for this would probably be: https://github.com/graphql-java-kickstart/graphql-java-servlet

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants