Overview - Subscriptions
What is it?
Subscriptions in NestJS allow your application to send real-time updates to clients. They are often used with GraphQL to push data changes instantly instead of waiting for clients to ask repeatedly. This means clients can listen for events like new messages or data changes and get notified immediately. Subscriptions keep the connection open so updates flow continuously.
Why it matters
Without subscriptions, apps rely on clients asking for updates again and again, which wastes time and resources and feels slow. Subscriptions solve this by pushing updates instantly, making apps feel alive and responsive. This is crucial for chat apps, live dashboards, or any feature needing real-time data. Without it, user experience suffers and servers get overloaded.
Where it fits
Before learning subscriptions, you should understand basic NestJS controllers and services, and how GraphQL queries and mutations work. After mastering subscriptions, you can explore advanced real-time patterns, WebSocket integrations, and scaling real-time features across multiple servers.