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!

To create a subscription, you will need to change query to subscription:

Subscription
subscription GetTodos {
  todos {
    title
    body
    done
  }
}

That's it!

Your data will always be in sync when using Subscriptions. It does not matter if the data changes through GraphQL or directly in the database via direct access.