Skip to main content
A subscription resolver returns an async iterator; the executor runs the selection set once per yielded value and emits one ExecutionResult per event.
subscribe() returns an async iterator of results, or a single ExecutionResult (with executed=False) when the document is invalid or is not a subscription. A subscription operation must select exactly one root field — this is enforced during validation. Per-event resolver errors are isolated to that event, and the source generator’s aclose() is guaranteed on disconnect or cancellation.

Transports

The shared HTTP handler drives subscriptions over a streaming transport, selected by the request’s Accept header:
  • graphql-transport-ws over WebSocket (connection_initnextcomplete).
  • Server-Sent Events (Accept: text/event-stream).
  • multipart/mixed (Accept: multipart/mixed).
The ASGI, Starlette, FastAPI, AIOHTTP, Quart, Litestar, and Channels adapters expose the WebSocket transport; every HTTP adapter supports SSE and multipart streaming.