Relay exposes the following APIs to create subscriptions.
Now let's take a closer look at the
graphqltagged subscription query.
variables: an object that contains the variables needed for the subscription.
onCompleted: a callback function executed when the subscription is closed by the peer without error.
onError: a callback function executed when Relay or the server encounters an error processing the subscription.
onNext: a callback function executed each time a response is received from the server, with the raw GraphQL response payload.
updater: an optional function that can supply custom logic for updating the in-memory Relay store based on the server response.
configs: an array containing the updater configurations. It is the same as
In a simple subscription, you only need
variables. This is
appropriate when you are only changing the properties of existing records that
can be identified by their
For more complex use-cases, you may wish to perform custom logic to update
Relay's in-memory cache when each subscription response is received. To do so,