Q28: How do GraphQL Subscriptions work under the hood?

Difficulty:IntermediateTopic:Real-time

Subscriptions use long-lived stateful connections (typically WebSockets via graphql-ws protocol). The client sends a subscription query once, and the server pushes incremental GraphQL response payloads whenever backend event publishers (e.g., Redis Pub/Sub, Kafka) emit relevant events.

Key Takeaways
  • Subscriptions establish bidirectional WebSocket streams for event-driven updates.
Knowledge Check

Which transport protocol is most commonly used to implement GraphQL Subscriptions?