-
Notifications
You must be signed in to change notification settings - Fork 11
GraphQL Subscriptions 101
Lucah Endicott edited this page Apr 28, 2022
·
9 revisions
What are subscriptions?
-
Apollo docs for Subscriptions
-
GraphQL Subscriptions with React and Apollo Client
-
Real-time data with AWS AppSync (GraphQL Subscription | Serverless Framework | AWS Amplify)
- Subscribe to data using AWS Amplify GraphQL client
Guide to testing real-time data with AWS AppSync for the RightOn Web App
- Log-in to RightOn AWS console and search for AppSync

- Select mobilebackend-dev.

- Select "Queries" form the sidebar.

- Select "Mutation" from the explorer drop down and click the "+" to add it.
- Select a game session field mutation to add with its required inputs using an existing sample game ID.
- Sample Game ID to use 08d19de5-6a49-4153-b3fc-998d783116c5
- Copy paste this ID into the "id*" input field in the purple text.
- Copy the existing AWS console URL from the page you're currently on into a new browser tab.
- In your new AWS query tab - select "Subscription" from the explorer drop down and click the "+" to add it.
- In your new tab with the subscription query added, select the corresponding game session field and select the fields you've taken as inputs from the Mutation query in your previous console tab.
- Click the "play" button above your subscription - this starts the subscription to listen for any updates.
- Direct yourself back to your AWS tab with your mutation query in place. Select a new "isPhaseOne" field from the dropdown.
- Click "Play" in your mutation explorer. You will see the data response with which phase you have chosen on the far right column.
- Direct yourself to the AWS console tab with your subscription running and you'll see the "isPhaseOne" field reflecting the status change in real-time!. You can continue to change the status and click play on your mutation query, and each time you view the subscription tab, that updated change will be reflected. This is a subscription listening for real-time changes anytime new information is added or updated.