Multipart subscriptions

Strawberry supports subscription over multipart responses. This is an alternative protocol created by Apollo to support subscriptions over HTTP, and it is supported by default by Apollo Client.

Support

We support multipart subscriptions in the following HTTP libraries:

Usage

Multipart subscriptions are opt-in. Enable them by including MULTIPART_SUBSCRIPTION_PROTOCOL in your integration’s subscription_protocols :

from strawberry.fastapi import GraphQLRouter
from strawberry.subscriptions import (
GRAPHQL_TRANSPORT_WS_PROTOCOL,
GRAPHQL_WS_PROTOCOL,
MULTIPART_SUBSCRIPTION_PROTOCOL,
)
from api.schema import schema
graphql_router = GraphQLRouter(
schema,
subscription_protocols=[
GRAPHQL_TRANSPORT_WS_PROTOCOL,
GRAPHQL_WS_PROTOCOL,
MULTIPART_SUBSCRIPTION_PROTOCOL,
],
)

Contributors:

Edit this page on GitHub