Recall & Review
beginner
What is a subscription in GraphQL?
A subscription is a special type of GraphQL operation that allows clients to receive real-time updates from the server whenever data changes.
Click to reveal answer
beginner
How do subscriptions differ from queries in GraphQL?
Queries fetch data once, while subscriptions keep a connection open to receive continuous updates as data changes.
Click to reveal answer
intermediate
Why do subscriptions enable real-time data?
Because subscriptions maintain an active connection between client and server, the server can push updates immediately when data changes, enabling real-time communication.
Click to reveal answer
intermediate
What role does WebSocket play in GraphQL subscriptions?
WebSocket is often used to keep the connection open for subscriptions, allowing the server to send data instantly without the client asking repeatedly.
Click to reveal answer
beginner
Give a real-life example of when subscriptions are useful.
Subscriptions are useful in chat apps where new messages appear instantly without refreshing, or in live sports scores that update as the game progresses.
Click to reveal answer
What does a GraphQL subscription do?
✗ Incorrect
Subscriptions keep a connection open so the server can send live updates to the client.
Which protocol is commonly used to support GraphQL subscriptions?
✗ Incorrect
WebSocket allows a persistent connection needed for real-time data in subscriptions.
How often does a GraphQL query fetch data?
✗ Incorrect
Queries fetch data once per request and do not keep the connection open.
Why are subscriptions better for live chat apps?
✗ Incorrect
Subscriptions push new messages instantly, making chat apps feel live and responsive.
What happens if a subscription connection closes?
✗ Incorrect
If the connection closes, the client no longer gets live updates from the server.
Explain in your own words why GraphQL subscriptions enable real-time data updates.
Think about how a phone call stays open to talk instantly instead of sending letters back and forth.
You got /3 concepts.
Describe a real-life scenario where using subscriptions would improve user experience.
Imagine waiting for a message or score update without refreshing the page.
You got /3 concepts.