File: other.rst

package info (click to toggle)
graphql-core 3.2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,384 kB
  • sloc: python: 45,812; makefile: 26; sh: 13
file content (28 lines) | stat: -rw-r--r-- 1,258 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Subscriptions
-------------

.. currentmodule:: graphql.execution

Sometimes you need to not only query data from a server, but you also want to push data
from the server to the client. GraphQL-core 3 has you also covered here, because it
implements the "Subscribe" algorithm described in the GraphQL spec. To execute a GraphQL
subscription, you must use the :func:`subscribe` method from the
:mod:`graphql.execution` package. Instead of a single
:class:`~graphql.execution.ExecutionResult`, this function returns an asynchronous
iterator yielding a stream of those, unless there was an immediate error.
Of course you will then also need to maintain a persistent channel to the client
(often realized via WebSockets) to push these results back.


Other Usages
------------

.. currentmodule:: graphql.utilities

GraphQL-core 3 provides many more low-level functions that can be used to work with
GraphQL schemas and queries. We encourage you to explore the contents of the various
:ref:`sub-packages`, particularly :mod:`graphql.utilities`, and to look into the source
code and tests of `GraphQL-core 3`_ in order to find all the functionality that is
provided and understand it in detail.

.. _GraphQL-core 3: https://github.com/graphql-python/graphql-core