UNPKG

@dillonkearns/elm-graphql

Version:

<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">

8 lines (5 loc) 955 B
## Is there an example? Yes, see https://github.com/dillonkearns/elm-graphql/tree/master/examples/src/subscription. If you don't use Absinthe, then your JavaScript code for the Ports will need to be changed out to use code for your specific server-side framework. ## How do I connect to my GraphQL Server using a Subscription? `Query`s and `Mutation`s in GraphQL have some standards for how to be sent (either HTTP GET or POST). However, `Subscription`s are not as standardized. The transfer protocol is completely non-standard. The handshakes and such to initialize the subscription are completely specific to each server-side GraphQL framework. That's why even with a native `Websocket` package in Elm (which as of this writing is not available in 0.19), it's best to use Ports to offload the responsibility of doing the Subscription handshake a JavaScript snippet or package that knows about your particular framework (Elixir/Abinsthe, for example).