← GraphQL learning path
GraphQL · Module 8 of 10

Subscriptions and real time

Push live updates to clients with subscriptions.

📖 Key ideas

  1. Subscriptions keep a connection open (usually WebSockets).
  2. subscription { messageAdded(room: "1") { text } }.
  3. Server publishes events via a PubSub system.
  4. Use for chat, live scores, notifications.
  5. Scale with Redis PubSub or managed services.
💡 Real-life example: A subscription is a radio channel: tune in once and keep hearing new updates.
SubscriptionReal-time GraphQL operation
WebSocketPersistent two-way connection
PubSubPublish/subscribe messaging
Live queryQuery that updates automatically