Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add graphql-ws support in light of subscriptions-transport-ws deprecation #1022

Closed
bglw opened this issue Feb 7, 2022 · 13 comments · Fixed by #1158
Closed

Add graphql-ws support in light of subscriptions-transport-ws deprecation #1022

bglw opened this issue Feb 7, 2022 · 13 comments · Fixed by #1158
Labels
enhancement Improvement of existing features or bugfix
Milestone

Comments

@bglw
Copy link

bglw commented Feb 7, 2022

This was mentioned in #896 but declined at that point. Since then, however, the winds of change have blown in favor of graphql-ws. The graphql-ws protocol differs from Apollo's original subscriptions-transport-ws protocol, and Apollo are soon to archive their protocol and are now recommending use of graphql-ws.

There is already some friction, as graphql-ws-client (and most ws clients coming out) only support the new protocol, while juniper only supports the old.

@bglw bglw added the enhancement Improvement of existing features or bugfix label Feb 7, 2022
@tyranron
Copy link
Member

tyranron commented Feb 8, 2022

@bglw thanks. We have plans to support both versions for the next major release.

@vincenzopalazzo
Copy link

@tyranron this feature is landed? :) was thinking that maybe I can be a good mentee? because I would like to have this feature

@tyranron tyranron added this to the 0.16.0 milestone Jun 30, 2022
@tyranron
Copy link
Member

@vincenzopalazzo nope, haven't touched it yet. Would like to see a PR from you, if you're willing to. As for design, I think it should be feature-gated in the existing crate. Thanks.

@vincenzopalazzo
Copy link

lets see if I can put in my todo list :) there is any channel that can make easy the onboarding on the package?

@tyranron
Copy link
Member

@vincenzopalazzo just ask directly in the related PR.

@davidgomesdev
Copy link

Is juniper using graphql-ws? I saw this workaround that came from this PR, so I thought juniper was already in graphql-ws.

However, I receive {"type":"ka"} messages, which isn't from that protocol AFAIK.

@vincenzopalazzo
Copy link

@LegendL3n I think the new protocol graphql-ws is still not supported, I was planning to add it in the next few months

@davidgomesdev
Copy link

Indeed.. Just saw on the README, that example really confused me 😅

@ccbrown
Copy link
Contributor

ccbrown commented Apr 3, 2023

I recently implemented the new protocol for another Go library, and could knock it out pretty quick here. It's fundamentally the same, but with some slight name changes and pings instead of keep-alives.

The worst part of it is just the naming of the protocol and libraries. The old protocol used the "graphql-ws" WebSocket subprotocol. Now, confusingly, the new protocol's reference implementation is a library called "graphql-ws". But it uses the "graphql-transport-ws" subprotocol. So I think the least confusing way to go about this is to forget about what the reference implementation is called, and organize based on the subprotocol name here.

So the new implementation can go into a new crate named juniper_graphql_transport_ws. And then in request routing, users can serve WebSocket requests using either the old juniper_graphql_ws or the new juniper_graphql_transport_ws crates based on subprotocol negotiation.

@allen-pattern
Copy link

Hello, is there any update here? Anything we can do to help see this feature rolled out?

@ccbrown
Copy link
Contributor

ccbrown commented Jun 28, 2023

Hello, is there any update here? Anything we can do to help see this feature rolled out?

@allen-pattern There's an implementation in the pull request here: #1158

If you'd like to help, you can:

  • Leave comments on the PR. Does the PR meet your needs? Any thoughts on the API / crate changes?
  • Give the PR a try and let us know how it works for you.

tyranron added a commit that referenced this issue Sep 21, 2023
- consider `juniper_graphql_transport_ws` crate on CI
- implement auto-selection of protocol in `juniper_warp` crate
- support `graphql-transport-ws` protocol in  `juniper_actix` crate
- implement auto-selection of protocol in `juniper_actix` crate

Additionally:
- move `examples/warp_subscriptions` into `juniper_warp/examples/subscription.rs`
- move `examples/actix_subscriptions` into `juniper_actix/examples/subscription.rs`
- move `examples/basic_subscriptions` into `juniper_subscriptions/examples/basic.rs`
- bump up MSRV of `juniper_actix` crate to 1.68
@chris-pattern
Copy link

Hi it looks like this was merged but I don't see the crate showing up on crates.io. Is there a plan for when it will be released?

@tyranron
Copy link
Member

tyranron commented Feb 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants