Recall & Review
beginner
What is a subscription resolver in GraphQL?
A subscription resolver is a special function in GraphQL that listens for real-time events and sends updates to clients when data changes.
Click to reveal answer
beginner
How does a subscription resolver differ from a query resolver?
A query resolver fetches data once when requested, while a subscription resolver keeps a connection open to send data updates continuously.
Click to reveal answer
intermediate
What role does PubSub play in subscription resolvers?
PubSub is a system that helps subscription resolvers by publishing events and allowing clients to subscribe to those events for real-time updates.
Click to reveal answer
intermediate
Why do subscription resolvers use WebSockets?
WebSockets keep a live connection between client and server, enabling subscription resolvers to push data instantly without repeated requests.
Click to reveal answer
advanced
What is the typical structure of a subscription resolver function?
It usually has a subscribe method that returns an AsyncIterator to listen for events, and optionally a resolve method to process the event data before sending.
Click to reveal answer
What does a subscription resolver primarily do?
✗ Incorrect
Subscription resolvers listen for events and send real-time updates to clients.
Which protocol is commonly used to maintain live connections for subscriptions?
✗ Incorrect
WebSocket keeps a persistent connection needed for real-time subscriptions.
In GraphQL subscriptions, what does PubSub help with?
✗ Incorrect
PubSub manages event publishing and subscription for real-time updates.
What does the subscribe method in a subscription resolver return?
✗ Incorrect
The subscribe method returns an AsyncIterator to listen for events.
Which of these is NOT a feature of subscription resolvers?
✗ Incorrect
Subscription resolvers do not fetch data just once; they provide continuous updates.
Explain how subscription resolvers work in GraphQL and why they are useful.
Think about how apps get live data like chat messages or notifications.
You got /5 concepts.
Describe the difference between query resolvers and subscription resolvers in GraphQL.
Compare a snapshot photo to a live video stream.
You got /4 concepts.