-
API Explorer
- Custom Functions
- Logs
- SQL Playground
- docs
- api explorer
- graphql api
- subscriptions
GraphQL Subscriptions
A GraphQL subscription is a web-socket connection where the client receives an event with data whenever the observed event occurs upstream.
All projects tables can receive subscriptions through the project endpoint using wss protocol.
wss://archie-core.archie-platform.com/subscriptions?project_id=projectID
For the sake of the any examples, let’s consider a scenario where a table called students exists, having expected fields and relations like firstName, email.
Creating a New Subscription
Section titled “Creating a New Subscription”To create a new subscription configuration, you use the system { createSubscription } mutation. This operation defines the rules for a subscription, including which tables to watch and what operations (Create, Update, Delete) should trigger an event.
GraphQL Mutation
Section titled “GraphQL Mutation”mutation createNewSubscription($input: SubscriptionInput!) { system { createSubscription(input: $input) { id active name } }}Variables
Section titled “Variables”{ "input": { "name": "students_all", "description": "Subscription all operations", "active": true, "tables": [ { "table": "students", "operations": ["UPDATE", "CREATE", "DELETE"], "fields": ["first_name", "email"] } ] }}