← GraphQL learning pathGraphQL · Module 8 of 10
Subscriptions and real time
Push live updates to clients with subscriptions.
📖 Key ideas
- Subscriptions keep a connection open (usually WebSockets).
- subscription { messageAdded(room: "1") { text } }.
- Server publishes events via a PubSub system.
- Use for chat, live scores, notifications.
- 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