GraphQL Subscription

Subscriptions are the same as queries, except they use WebSockets to keep the data up to date in your app. Subscriptions allow realtime updates!

Change query to subscription to create a subscription:

subscription GetTodos {
todos { title body done } }

That's it!

Your data is always in sync when using subscriptions. It does not matter if the data changes through GraphQL or directly in the database. The data is always syncing in realtime using subscriptions.