Open 3nigm4 opened 6 years ago
Thanks for the heads up about this! I will dig into the new spec and try to put some time into implementation soon.
I've now done a fair bit of research into this and unfortunately I've encountered a huge roadblock: the most popular transport protocol for GraphQL subscriptions relies on the client specifying the protocols
argument of the WebSocket
constructor. Unfortunately the elm-lang/websocket
package currently offers no way of specifying this argument:
https://github.com/elm-lang/websocket/issues/20
Apparently the only way to specify websocket subprotocols in Elm right now is to write your websocket code in JS and communicate with ports. That means that pretty much the only worthwhile thing that I can add to this package right now is a way to build decodable subscription requests, but I can't really offer any way to send them and listen for responses from within Elm; the end user will need to figure out that part for themselves with ports :(
Actually there is one relatively popular transport that I may be able to provide an implementation for, which is the one based on Phoenix Channels used by the Absinthe
package for Elixir. I'll have to do more research into that and if it ends up making sense I would probably make a separate package for that transport.
Thanks for your research on this!
@jamesmacaulay any more thoughts on this? I've used the phoenix channels and JS. But have been wanting to learn elm and wasn't sure if it could replace some of the things I have been wanting to do.
Hello,
thanks for this library. The latest GraphQL spec was just released and a lot of stuff on your roadmap is now part of the spec, like subscriptions.... https://github.com/facebook/graphql/releases/tag/June2018 ... therefor ... Featuer Request 🥇 Subscriptions