Debian Codegraph @

docs/usage/other.rst

raw
1 Subscriptions
2 -------------
3
4 .. currentmodule:: graphql.execution
5
6 Sometimes you need to not only query data from a server, but you also want to push data
7 from the server to the client. GraphQL-core 3 has you also covered here, because it
8 implements the "Subscribe" algorithm described in the GraphQL spec. To execute a GraphQL
9 subscription, you must use the :func:`subscribe` method from the
10 :mod:`graphql.execution` package. Instead of a single
11 :class:`~graphql.execution.ExecutionResult`, this function returns an asynchronous
12 iterator yielding a stream of those, unless there was an immediate error.
13 Of course you will then also need to maintain a persistent channel to the client
14 (often realized via WebSockets) to push these results back.
15
16
17 Other Usages
18 ------------
19
20 .. currentmodule:: graphql.utilities
21
22 GraphQL-core 3 provides many more low-level functions that can be used to work with
23 GraphQL schemas and queries. We encourage you to explore the contents of the various
24 :ref:`sub-packages`, particularly :mod:`graphql.utilities`, and to look into the source
25 code and tests of `GraphQL-core 3`_ in order to find all the functionality that is
26 provided and understand it in detail.
27
28 .. _GraphQL-core 3: https://github.com/graphql-python/graphql-core