docs/general/multipart-subscriptions.md
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.
We support multipart subscriptions in the following HTTP libraries:
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,
],
)