larshei
Receive Absinthe GraphQL subscription updates in a client
As a simple example, a server stores posts and clients can create posts. Other clients should receive updates, when a new post is created, based on a post subscription.
Embedded Device --(creates_post)--> Data Server <--(subscribes)-- Some Client we don't know yet
The server is set up with a schema that includes a subcription.
Using graphiql on the server I can subscribe to post_created that is triggered whenever a new post is created and updates are displayed in graphiql whenever I create a new Post by using HTTPoison through the elixir shell.
Communication is done using phoenix channels between the server and graphiql, right?
Thats not really something I can use to communicate with some client that I do not know much about.
How would I expose the subscription to a graphQL client?
I probably cant use phoenix channels and read something about Apollo?
Is there a more generic way or would apollo be the generic way?
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










Marked As Solved
vincer
The generic way would probably just be with the phoenix npm package:
https://www.npmjs.com/package/phoenix
We use this method to update web pages live in a CMS. We send a subscribe GraphQL query, store the ID returned and then handle the “subscribe:data” events that Absinthe/Phoenix sends down.