Recall & Review
beginner
What is a subscription in GraphQL?
A subscription in GraphQL is a way to get real-time updates from the server. It keeps a connection open and sends data to the client whenever an event happens.
Click to reveal answer
beginner
What happens when a client starts a subscription?
When a client starts a subscription, it opens a persistent connection to the server, usually over WebSocket, to listen for specific events or data changes.
Click to reveal answer
intermediate
How does the server send data during a subscription?
The server sends data to the client whenever the subscribed event occurs. This data is sent as a stream of messages over the open connection.
Click to reveal answer
intermediate
What is the role of WebSocket in GraphQL subscriptions?
WebSocket provides a full-duplex communication channel that stays open, allowing the server to push updates to the client instantly during a subscription.
Click to reveal answer
beginner
How does a client stop a subscription?
A client stops a subscription by closing the connection or sending an unsubscribe message, which tells the server to stop sending updates.
Click to reveal answer
What does a GraphQL subscription do?
✗ Incorrect
Subscriptions keep a connection open to receive real-time data updates from the server.
Which protocol is commonly used to keep a subscription connection open?
✗ Incorrect
WebSocket allows full-duplex communication needed for real-time subscriptions.
When does the server send data in a subscription?
✗ Incorrect
The server pushes data to the client whenever the event the client subscribed to occurs.
How does a client end a subscription?
✗ Incorrect
Closing the connection or sending an unsubscribe message stops the subscription.
What is the main benefit of using subscriptions?
✗ Incorrect
Subscriptions provide real-time updates without the need for repeated polling.
Explain the lifecycle of a GraphQL subscription from start to finish.
Think about how the connection starts, how data flows, and how it ends.
You got /5 concepts.
Describe why WebSocket is important for GraphQL subscriptions.
Consider how data moves between client and server continuously.
You got /4 concepts.