0
0
NestJSframework~5 mins

Subscriptions in NestJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Subscription in NestJS GraphQL?
A Subscription in NestJS GraphQL is a way to send real-time updates from the server to the client. It uses WebSockets to push data whenever an event happens, like new messages or notifications.
Click to reveal answer
beginner
Which decorator is used to define a Subscription resolver method in NestJS?
The @Subscription() decorator is used to mark a method as a Subscription resolver in NestJS GraphQL.
Click to reveal answer
intermediate
How does NestJS handle the event stream for Subscriptions?
NestJS uses an event-based system, often with PubSub (Publish-Subscribe) pattern, to emit events that trigger Subscription updates to clients.
Click to reveal answer
beginner
What transport protocol do GraphQL Subscriptions typically use in NestJS?
GraphQL Subscriptions in NestJS typically use WebSockets to maintain a persistent connection for real-time data transfer.
Click to reveal answer
beginner
Why are Subscriptions useful in web applications?
Subscriptions let the server send updates instantly to clients without the client asking repeatedly. This is great for chat apps, live feeds, or notifications.
Click to reveal answer
Which decorator do you use to create a Subscription resolver in NestJS?
A@Mutation()
B@Query()
C@Subscription()
D@Resolver()
What protocol do NestJS GraphQL Subscriptions use to send real-time data?
AWebSockets
BHTTP
CFTP
DSMTP
What pattern is commonly used in NestJS to manage events for Subscriptions?
APubSub (Publish-Subscribe)
BFactory
CSingleton
DDecorator
Which of these is NOT a typical use case for Subscriptions?
AChat messages
BLive notifications
CReal-time feeds
DStatic page rendering
In NestJS, what do you need to import to use Subscriptions with GraphQL?
AHttpModule
BGraphQLModule with subscriptions enabled
CCacheModule
DConfigModule
Explain how Subscriptions work in NestJS GraphQL and why they are useful.
Think about how the server sends data without the client asking repeatedly.
You got /4 concepts.
    Describe the steps to create a Subscription resolver in NestJS.
    Focus on decorators, event publishing, and module setup.
    You got /4 concepts.