Graphql-ruby: GraphQL Subscriptions

Created on 6 Aug 2016  路  6Comments  路  Source: rmosolgo/graphql-ruby

@rmosolgo

Love this gem, we have it running in production albeit we are a super small shop. Thanks also for keeping our blog post on the graphql README.

  • Are there any plans for GraphQL subscription (https://github.com/facebook/relay/issues/541), or it is already there? I looked through the code and saw that there are some declarations but no implementation yet?
  • If it is not there yet, I would like to help. How long do you think it would take to implement the most basic form of it?

Most helpful comment

I extracted it to a gem here: https://github.com/rmosolgo/graphql-streaming

All 6 comments

Yes, right now support is pretty minimal: we accept a root subscription type and we execute subscription queries against that root. I'm not sure exactly what else the gem needs -- storing subscriptions and delivering payloads is very application-specific right?

I tinkered a while back to get this working on ActionCable:

The basic bits are in place, but there are still a _few_ things to work out! For example:

  • "Automatic" mapping of subscription fields + arguments to ActionCable broadcasts?
  • Don't parse the query every time
  • Better way than send(:transmit, ...) to stream to the client?

Whoa...really nice!! Let me give this a shot. I would need to somehow install ActionCable though since I'm on Rails 4.2, and ActionCable is no longer available as a a separate gem.

Feel free to close this, or I can keep you posted on my attempt to make this work on my Rails app here or even somewhere else, whatever works best for you.

One of our apps uses Pusher, I think it would be possible to implement something similar on top of that service instead of ActionCable

Thanks for the tip!

I extracted it to a gem here: https://github.com/rmosolgo/graphql-streaming

Thank you as always! Love your work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sayduck-daniel picture sayduck-daniel  路  3Comments

jtippett picture jtippett  路  3Comments

rylanc picture rylanc  路  3Comments

KevinColemanInc picture KevinColemanInc  路  3Comments

theodorton picture theodorton  路  3Comments