Implement Apollo WebSocket protocol
thosakwe opened this issue · comments
Subscription support is now available (not yet on Pub, also not yet thoroughly tested at all).
I intend to add some functionality to package:graphql_server
that implements Apollo's WebSocket protocol:
https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
This will be built on top of package:stream_channel
(or even just dart:async
, so that users of any framework/infrastructure can use it.
Of course, package:angel_graphql
will have some functionality to make this easy to use within Angel.
Something like:
var graphQL = GraphQL(...);
app.get('/api/graphql_ws', graphQLWS(graphQL));
So, I've completed my implementation of the Apollo spec, but there's one issue... The Apollo spec is egregiously inaccurate, and completely out-of-sync with the format their actual client expects.
Follow this issue for updates:
apollographql/subscriptions-transport-ws#551
That being said, graphQLWS
will be present in this next release of package:graphql_server
. I am holding off on including unit tests until the referenced issue is addressed, as there's no sense in testing an incorrect spec.
The graphql_server
docs will include information on how to set up a simple server, so that you can roll-your-own WebSocket support, on a case-by-case basis.
I am hesitant to define yet another protocol, so graphQLWS
will rely on Apollo, at least for the foreseeable future.
I looked through their server code, and now the Angel implementation is consistent with theirs, though the spec is still very misleading.
The minimum version of subscriptions-transport-ws
you can use is 0.8.3
.