midGraphQL
What are GraphQL Subscriptions?
Updated Apr 28, 2026
Short answer
Subscriptions are long-lasting operations that allow the server to push real-time updates to the client.
Deep explanation
Usually implemented over WebSockets, a client sends a subscription query and maintains an open connection. When a specific event occurs on the server (often triggered by a mutation via a PubSub system), the server pushes the new data down to all subscribed clients.
Real-world example
Building a live chat application where new messages appear instantly on the screen without polling the server.
Common mistakes
- Using subscriptions for data that rarely changes, keeping unnecessary WebSocket connections open and wasting server resources.
Follow-up questions
- What is a PubSub system?