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
feat(subscription): implement new rising protocol graphql-ws
#958
Comments
graphql-ws
graphql-ws
Thanks @jjangga0214 for these details. It should be mentionned on the readme that graphql-flutter is not supporting graphql-ws protocol (and thus, it's - for now - a useless library as it's the new standard...) Do you know some other library - up to date with WebSocket standards ? |
Would be nice to implemented as soon as possible. thx! |
I also needed this, so i put together a quick working example: https://github.com/maximilianmaihoefner/graphql-flutter/tree/graphql-transport-ws You can try it out by specifying the following in your
And specifying the new Subprotocol when creating the final WebSocketLink websocketLink = WebSocketLink(
subscriptionUri,
config: const SocketClientConfig(autoReconnect: false),
subProtocol: SocketSubProtocol.graphqlTransportWs,
); The main changes have been made in websocket_client.dart, it is however not a super clean implementation. |
@maximilianmaihoefner Why not open a PR to contribute to your work? |
@vincenzopalazzo I considered opening a PR, but I don't think my implementation is super clean or maintainable, it probably needs a better concept for supporting both subprotocols. Right now I'm just doing string comparisons to decide which Message to send, it is also missing tests. And I'm not sure I have the time right now to work on these issues. If you want I can submit a PR, but as mentioned, I don't think its in a mergeable state. |
@maximilianmaihoefner I see the code, and yes I agree with your with the better implementation of the protocol healing. However, we can integrate it and clean it after more testing. Nothings born clean the first time :) |
@vincenzopalazzo I opened a PR, another thing that should be looked at is the ping implementation, right now I'm highjacking the inactivityTimeout, which results in a ping every 30 Seconds, the original JS-Client, by default, never sends pings. Only if the |
I am confused by some of the comments. Based on the PR, graphql-ws (the newer protocol) was already implemented. It's the older version of the protocol that you're adding? |
Nevermind, I see the difference now. |
@chrisdrobison No worries, I was confused when I looked at the code for the first time as well. The new protocol is called |
The official GraphQL specification deliberately does not specify the transport layer.
For subscription, historically, GraphQL over WebSocket Protocol by apollographql/subscriptions-transport-ws library is widely adapted as de-facto standard.
However, the library is not actively maintained, and it officially recommends migrating to the "new" GraphQL over WebSocket Protocol of enisdenjo/graphql-ws.
Those two protocols are incompatible with each other.
The ecosystem is incrementally adapting to the new de-facto standard.
Currently,
graphql_flutter
only implementssubscriptions-transport-ws
's protocol. So, if a server usesgraphql-ws
protocol,graphql_flutter
cannot be used.Thus, hereby I request implementing a new protocol.
Thanks.
The text was updated successfully, but these errors were encountered: