You are looking at the docs for the unreleased main branch of Dgraph. The latest version is v23.1.
Ask a Question

@withSubscription

The @withSubscription directive enables subscription operation on a GraphQL type.

A subscription notifies your client with changes to back-end data using the WebSocket protocol. Subscriptions are useful to get low-latency, real-time updates.

To enable subscriptions on any type add the @withSubscription directive to the schema as part of the type definition, as in the following example:

type Todo @withSubscription {
  id: ID!
  title: String!
  description: String!
  completed: Boolean!
}

Refer to GraphQL Subscriptions to learn how to use subscriptions in you client application.