Updating data online could simply be for the current user as in the case of them updating their settings. But for public data like posts, you want to subscribe to the updates and display them to the user. The functionality could include storing the updated data in the case, model, and refreshing the UI.
- [Instructor] So now we're going to handle subscriptions…for any updated posts.…Very, very similar to what we just did…with CreatePostSubscription.…So let's go back to the top,…I'm going to do a, jump to the watcher…and I'm just going to copy line 65…where we created our first watcher…and I'll call this watcherUpdate…and so instead of OnCreatePostSubscription,…you got it,…OnUpdatePostSubscription.…Now I'm going to go all the way back down…to the bottom of my file…and I'm going to copy this, startSubscription function.…
And paste this.…And I'll call this startSubscriptionUpdate…and I just have to change everything to be update…so on line 348 it'll be watcherUpdate.…It'll be a subscription OnUpdatePostSubscription.…I don't want to add the item to the array…because it's already in the array…so we can either search for it in there…or we might want to just fetch from the server,…so let's do that.…
We'll just say for this one to handle it,…maybe a little easier,…so we're just going to say, if you get an update,…fetch the posts.…
- Preparing to use AppSync in code
- Updating settings and the schema
- Adding a second data source
- Storing posts online
- Updating subscriptions in schema
- Testing live updates
- Handling updated posts
- Offline capabilities
Skill Level Intermediate
1. AWS User Authentication
2. AppSync Setup
Amplify codegen3m 42s
3. App Code and Configuration
4. Adding a Second Datasource
5. Real-Time Updates
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.