For the sake of the any examples, let's consider a scenario where a table called Posts exists, having expected fields and relations like title, body, author, etc.
A GraphQL subscription is a web-socket connection where the client receives an event with data whenever the observed event occurs upstream.
8base's GraphQL engine auto-generates subscriptions as part of the GraphQL schema based on your workspace tables. All workspace tables can receive subscriptions through the workspace endpoint using
Whenever a table is added to a work space, a GraphQL subscriptions operation is auto-generated for the table.
filteras an argument with which it will listen for specified mutation events on one or more scoped records.
8base accepts to the following subscription argument.
- filter. A
SubscriptionFiltertype filter containing values for mutation types, table filter, and updated fields filter.
SubscriptionFilter type is different from filters used in GraphQL queries. Instead, the
SubscriptionFilter contains 3-top level keys:
- mutation_in: An array of mutation events on which to listen (create, update, delete).
- node: Normal query filter that allows for scoping of one or more records.
- updatedFields: For specifying which individual fields to observe.