I am trying to archive graphql subscription using apollo + Rails actioncable (redis pubsub backend).
problem
Currently, I am using graphql-ruby and doing query
and mutation
fine, but the gem doesn't support subscription
.
thoughts
I only have a minor knowledge about graphql and redis, and so this may sound foolish but I am thinking if I set up a separated graphql server (only for subscription
) that is connected to the same redis database that the rails is using, broadcasting from rails' actioncable to the redis should be picked up by the graphql server?
rails
sends a hash data through broadcast
as usual, no changes.
ActionCable.server.broadcast(...)
separated graphql server
setup a graphql server using GraphQL subscriptions with Redis Pub Sub somehow, and wait for the rails' broadcastings through redis.
is this all workable?
or are there other possible ways to impliment graphql subscription in rails?