Skip to content

Fix Apollo subscription message handling #371

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

Merged
merged 4 commits into from
Sep 24, 2019

Conversation

smyrick
Copy link
Contributor

@smyrick smyrick commented Sep 23, 2019

📝 Description

Support the messages that come from the Apollo client subscriptions.

https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md

We need to wrap the GraphQLRequest and GraphQLResponse in a special message before we send it over the web socket. That message structure is implemented in the handler for the graphql-ws protocol

🔗 Related Issues

Fixes #370

@smyrick smyrick added the type: bug Something isn't working label Sep 23, 2019
@codecov-io
Copy link

codecov-io commented Sep 23, 2019

Codecov Report

Merging #371 into master will decrease coverage by 0.09%.
The diff coverage is 92.4%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master     #371     +/-   ##
===========================================
- Coverage     94.38%   94.28%   -0.1%     
- Complexity      323      338     +15     
===========================================
  Files            97       99      +2     
  Lines          1139     1207     +68     
  Branches        204      213      +9     
===========================================
+ Hits           1075     1138     +63     
- Misses           22       26      +4     
- Partials         42       43      +1
Impacted Files Coverage Δ Complexity Δ
...pring/exception/UknownSubscriptionOperationType.kt 0% <0%> (ø) 0 <0> (?)
...aphql/spring/model/SubscriptionOperationMessage.kt 100% <100%> (ø) 4 <4> (?)
...up/graphql/spring/SubscriptionAutoConfiguration.kt 100% <100%> (ø) 6 <2> (+1) ⬆️
...p/graphql/spring/GraphQLConfigurationProperties.kt 100% <100%> (ø) 3 <0> (ø) ⬇️
...l/spring/execution/SubscriptionWebSocketHandler.kt 85.71% <100%> (-7.15%) 2 <0> (ø)
...ing/execution/ApolloSubscriptionProtocolHandler.kt 92.98% <92.98%> (ø) 11 <11> (?)
.../graphql/generator/extensions/graphQLExtensions.kt 100% <0%> (ø) 0% <0%> (ø) ⬇️
.../graphql/exceptions/NestingNonNullTypeException.kt
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03a881e...877a337. Read the comment docs.

@smyrick smyrick marked this pull request as ready for review September 24, 2019 21:16
smyrick added 2 commits September 24, 2019 14:22
The config value for the packages is overriden in the hooks so we can remove it
@smyrick
Copy link
Contributor Author

smyrick commented Sep 24, 2019

Here is an example of the subscriptions working on the playground

Screen Shot 2019-09-24 at 2 25 39 PM

@smyrick smyrick added the changes: patch Changes require a patch version label Sep 24, 2019
@smyrick
Copy link
Contributor Author

smyrick commented Sep 24, 2019

And here is a keep alive example where the client stops the connection

Screen Shot 2019-09-24 at 2 36 26 PM

@smyrick smyrick merged commit bfbd1a9 into ExpediaGroup:master Sep 24, 2019
@smyrick smyrick deleted the kotlin-flow-subscriptions branch September 24, 2019 21:37
@smyrick smyrick added changes: minor Changes require a minor version and removed changes: patch Changes require a patch version labels Sep 24, 2019
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
* Fix Apollo subscription message handling

* Implement graphql-ws spec

Here is the spec https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md

* update spring config metadata

* Remove unused config

The config value for the packages is overriden in the hooks so we can remove it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: minor Changes require a minor version type: bug Something isn't working
Development

Successfully merging this pull request may close these issues.

Subscription support graphql-ws protocol
3 participants