Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (30 sloc) 1.27 KB

Subscriptions

A GraphQL subscription is essentially a query where the client receives an event whenever the value of any field changes upstream. The Hasura GraphQL engine supports subscriptions for all kind of queries. All the concepts of :doc:`queries <../queries/index>` hold true with subscriptions as well.

Convert a query to a subscription

You can turn any query into a subscription by simply replacing query with subscription as the operation type.

Caveat

Hasura follows the GraphQL spec which allows for only one root field in a subscription.

Use cases

Communication protocol

Hasura GraphQL engine uses the GraphQL over Websocket Protocol by the apollographql/subscriptions-transport-ws library for sending and receiving events.

.. toctree::
  :maxdepth: 1
  :hidden:

  Sample use cases <use-cases>