Subscriptions allow GraphQL clients to observe specific events and receive updates from the server when those events occur. This supports live updates, such as websocket pushes. Subscriptions introduce several new concepts:
subscription is an entry point to your GraphQL schema, like
mutation. It is defined by your
SubscriptionType, a root-level
Read more in the Subscription Type guide.
GraphQL::Schema::Subscription is a resolver class with subscription-specific behaviors. Each subscription field should be implemented by a subscription class.
Read more in the Subscription Classes guide
After an event occurs in our application, triggers begin the update process by sending a name and payload to GraphQL.
Read more in the Triggers guide.
Besides the GraphQL component, your application must provide some subscription-related plumbing, for example:
By default, the subscription implementations listed above handle each subscription in total isolation. However, this behavior can be optimized by setting up broadcasts. Read more in the Broadcast guide.
See the Multi-tenant guide for supporting multi-tenancy in GraphQL subscriptions.