GraphQL subscriptions push events to a connected client whenever data changes. Archie publishes an event when a row is inserted, updated, or deleted on a watched table; a subscribed client receives the event over a WebSocket. You configure subscriptions in two stages:Documentation Index
Fetch the complete documentation index at: https://archie.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
- Define the subscription — what to watch — by calling a mutation under the
systemnamespace. - Connect to the WebSocket endpoint with the subscription’s id; events flow over that connection until you disconnect.
wss:// protocol. The endpoint is per-environment — see Environments.
Defining a subscription
Subscriptions are first-class records. Create them withsystem { createSubscription }, update them with system { updateSubscription }, and remove them with system { deleteSubscription }.
Create
id. Hold on to it — that’s how you reference the subscription on a WebSocket connection and how you update or delete it later.
Update
Delete
Watching multiple tables
A single subscription can watch any number of tables, each with its own operations and field set:Filtered subscriptions
To receive events only for records matching a condition, attachconditions to a table block. Conditions stack with logical AND.
| Operator | Example |
|---|---|
EQ | status = "active" |
NEQ | type != "admin" |
GT | age > 18 |
LT | price < 100 |
GTE | score >= 80 |
LTE | attempts <= 3 |
CONTAINS | name contains "john" |
STARTSWITH | email startsWith "admin" |
ENDSWITH | domain endsWith ".com" |
On the WebSocket side
Once the subscription exists, connect to the WebSocket endpoint and reference the subscription id. Most GraphQL client libraries (Apollo, urql, graphql-ws) handle the connection lifecycle for you — you provide the WebSocket URL and an authentication token, and they deliver events to a callback. Events arrive as JSON payloads matching thefields declared on each table block, plus the operation type (CREATE, UPDATE, DELETE). Toggle active: false to pause delivery without deleting the subscription.
Permissions
Subscriptions honor the read permissions defined in Role-Based Access. A connected client only receives events for records and fields it’s allowed to read; everything else is filtered out before delivery.Authentication
WebSocket connections require the same authentication tokens as queries and mutations — issued by an authentication provider configured in App Services → Authentication Providers. Pass the token through the connection params your GraphQL client supports.FAQ
When should I use a subscription instead of polling?
When should I use a subscription instead of polling?
Use a subscription when you need event-driven UI updates — collaborative editing, live dashboards, chat — and the upstream change rate is low to moderate. For high-volume or batched changes, polling at a controlled interval is often simpler and cheaper.
Do subscriptions work in browsers without WebSocket support?
Do subscriptions work in browsers without WebSocket support?
What's the difference between a subscription and a webhook?
What's the difference between a subscription and a webhook?
A subscription pushes events over a WebSocket to a long-lived client connection. A webhook pushes events over HTTP to a server URL you control. Subscriptions are best for client UIs; webhooks are best for backend systems integrating with your data.
Can I subscribe to changes on a related table?
Can I subscribe to changes on a related table?
What happens if I miss events while disconnected?
What happens if I miss events while disconnected?
Subscriptions are not durable queues — events fire while the WebSocket is connected. For at-least-once delivery to a backend, use webhooks, which retry on failure.