diff --git a/core/graphql.md b/core/graphql.md index 1c175df9526..2756d5d8e2d 100644 --- a/core/graphql.md +++ b/core/graphql.md @@ -448,6 +448,94 @@ Your custom mutations will be available like this: } ``` +## Subscriptions + +Subscriptions are an [RFC](https://github.com/graphql/graphql-spec/blob/master/rfcs/Subscriptions.md#rfc-graphql-subscriptions) to allow a client to receive pushed realtime data from the server. + +In API Platform, the built-in subscription support is handled by using [Mercure](https://mercure.rocks/) as its underlying protocol. + +### Enable Update Subscriptions for a Resource + +To enable update subscriptions for a resource, three conditions have to be met: +- the [Mercure hub and bundle need to be installed and configured](mercure.md#installing-mercure-support). +- Mercure needs to be enabled for the resource. +- the `update` mutation needs to be enabled for the resource. + +For instance, your resource should look like this: + +```php +