Table of Contents
Action Cable Provider
The Action Cable Provider uses a channel to communicate with your front end using a web socket.
First, you must ensure that you have properly set up
Then you can use the provided
or implement your own, taking advantage of the
The concern was designed to be easily overridden, allowing you to decide which parts you want to use and which ones you need to add or change the settings. For example, here is how you can add your own context:
# app/channels/graphql_channel.rb class GraphQLChannel < ApplicationCable::Channel include GraphQL::Channel protected def gql_context(*) super.merge(current_user: current_user) end end
Read more about customizing the Channel.
How it Works
The provider uses the Action Cable server and its underlying pub-sub mechanism to stream subsequent results from subscriptions. It will create one stream per subscription plus an internal asynchronous callback.
Here is everything that you can configure for this provider:
::ActionCable- The Action Cable class
rails-graphql- The streams prefix
Rails::GraphQL::Subscription::Store::Memory.new- The store of the subscriptions
Rails::GraphQL.logger- The logger