0
0
GraphQLquery~10 mins

Why subscriptions enable real-time data in GraphQL - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a subscription that listens for new messages.

GraphQL
subscription { [1] newMessage { id content } }
Drag options to blanks, or click blank then click option'
Aon
Badded
Clisten
Dsubscribe
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'added' instead of 'on' causes syntax errors.
Using 'subscribe' or 'listen' are not valid GraphQL keywords here.
2fill in blank
medium

Complete the subscription to receive real-time updates for user status changes.

GraphQL
subscription { [1] userStatusChanged { userId status } }
Drag options to blanks, or click blank then click option'
Alisten
Bwatch
Ctrigger
Don
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'trigger' or 'watch' are not valid GraphQL subscription syntax.
Forgetting the keyword causes syntax errors.
3fill in blank
hard

Fix the error in the subscription to correctly listen for new comments.

GraphQL
subscription { [1] newComments { id text author } }
Drag options to blanks, or click blank then click option'
Alisten
Bwatch
Con
Dsubscribe
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'subscribe' instead of 'on' causes syntax errors.
Using 'listen' or 'watch' are not valid GraphQL keywords here.
4fill in blank
hard

Fill both blanks to complete the subscription that listens for order updates with id and status fields.

GraphQL
[1] { [2] orderUpdated { id status } }
Drag options to blanks, or click blank then click option'
Aon
Bsubscription
Cquery
Dmutation
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'query' or 'mutation' instead of 'subscription' for the operation.
Using 'query' or 'mutation' inside the subscription block.
5fill in blank
hard

Fill both blanks to complete the subscription that listens for chat messages with id, text, and sender fields.

GraphQL
[1] { [2] chatMessageReceived { id text sender } }
Drag options to blanks, or click blank then click option'
Asubscription
Bon
Cquery
Dmutation
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'query' or 'mutation' instead of 'subscription' for the operation.
Omitting the 'on' keyword inside the subscription.