Skip to content
v1.0.0

Subscriptions and transports

Running a subscription over graphql-ws and watching events stream into the log, then stopping it. Narrated, with sound. The dark and light versions follow the site's theme.

Pick a transport per tab with the Transport select in the request bar:

Transport Use it for
Auto (default) Queries and mutations over HTTP, subscriptions over graphql-ws.
HTTP Plain HTTP requests only.
graphql-ws Subscriptions over the graphql-transport-ws protocol.
subscriptions-transport-ws The legacy Apollo WebSocket protocol.
SSE GraphQL over Server-Sent Events, on distinct connections.
Multipart HTTP multipart/mixed: Apollo multipart subscriptions and @defer / @stream.

WebSocket transports use a WS endpoint. By default it’s the endpoint with http→ws and https→wss.

Browsers can’t set WebSocket headers, so the Headers JSON is sent as connectionParams. If the WebSocket URL is unencrypted (ws://) and not a loopback host, the Headers section warns that headers travel in clear text. Cookies on the handshake follow the browser’s own rules, not the Send cookies toggle.

A connection opens only when you press Run, and it never reconnects on its own. Stop, closing the tab, or running again closes it.

A stream shows a live event log. The newest 1,000 events are kept; older ones are counted as “earlier events not shown”.

The local test server exposes:

  • /graphql-ws and /graphql-ws-auth (needs connectionParams.authorization = "Bearer test")
  • /graphql-legacy
  • /graphql-sse
  • /graphql-multipart
  • @defer on /graphql
subscription {
countdown(from: 5, intervalMs: 700)
}

Change the default transport used by Auto in Settings (Subscription transport for Auto).