-
Notifications
You must be signed in to change notification settings - Fork 7
feat: implement websocket subprotocols for subscriptions graphql-ws
, graphql-transport-ws
#21
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
base: main
Are you sure you want to change the base?
feat: implement websocket subprotocols for subscriptions graphql-ws
, graphql-transport-ws
#21
Conversation
Co-authored-by: Mal Miller <59854849+mmiller-max@users.noreply.github.com>
Co-authored-by: Mal Miller <59854849+mmiller-max@users.noreply.github.com>
d761bb9
to
504992c
Compare
504992c
to
d9af5c5
Compare
Codecov Report
@@ Coverage Diff @@
## main #21 +/- ##
===========================================
- Coverage 67.27% 57.12% -10.16%
===========================================
Files 17 18 +1
Lines 602 702 +100
===========================================
- Hits 405 401 -4
- Misses 197 301 +104
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
On version 0.7.5 opening a subscription to a Hasura `Cannot `convert` an object of type Nothing to an object of type String`
That happens because the server sends a keepalive message that doesn't have all the fields defined in
where the solution - at least for this server - is to align the protocols. I'm looking for a new way to also fix the tests of the subscriptions using a server in GitHub actions. |
graphql-ws
, graphql-transport-ws
Implements https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md and the newer and currently maintained https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
WebSocket subscription works on Hasura
2.14.0-beta-1
with this patch, using both protocols.One can choose protocol (sub-protocol) by using the kwargument to
open_subscription
:websocket_protocol
. By default this is set to"graphql-ws, graphql-transport-ws"
which leaves the decision up to the server. It can be overriden with any of the two values;GraphQLClient.PROTOCOL_GRAPHQL_WS
orGraphQLClient.PROTOCOL_APOLLO_OLD
. In that case, the client will explicitly request one protocol (and the server should comply - if it doesn't we adapt).Includes #19 so le'ts put that in first.