Web Storage APIs Data Sync & Security
Transcript from the "Data Sync & Security" Lesson
>> And for data syncs, there are a lot of algorithms, ideas, there are many, even books on that topic, maybe not just on the web. How you sync data because what happens if the data changed server-side, and also client side at the same time, how you're going to manage that, so it's a whole topic by itself, data syncing.
[00:00:22] And for data syncing, you should Master Service Workers and the sync's API. Backgroung sync, periodic background sync, background fetch, and many others. And always think about versions and data migration between versions, okay? So, there is a new version of your app, so the user, we need to remember that the user may come back to your app a year later.
[00:00:49] And in a year, maybe you've changed your app 15 times and your schema 15 times. So, don't think that you're always migrating data from the previous version to the new one, no. The user might be coming back, okay, and it needs 15 migrations. Of course, at that point, some apps are saying, now this is too old, I'm sorry user, I'm not going to migrate your data, or you have a history of migration algorithms.
[00:01:18] So you run through version 2 to 3, 3 to 4, 4 to 5, until version 15 and you cross your fingers that everything will work, okay? But that's also possible Makes sense? And in terms of security, remember that all browser data storage is public, okay? So it's insecure by definition, don't store there anything that is sensitive.
[00:01:47] No private data, no sensitive data. And if you store authentication data, have in mind that data should be revoked somehow, there should be a way to revoke that data, okay? And where to continue and rate more do more, Web Workers. So mastering Web Workers will help in Data Management, Service Workers, the Sync API's, and more about IndexedDB performance, okay?
[00:02:17] And finally, Web Assembly-based Databases, that's high performance, there are things that can be done there. And where do you store those databases? They can be on top of IndexedDB, so you use IndexedDB as a file system kind of, or the real file system, it's also possible. And then you can use MySQL technically if you want.
[00:02:42] The problem with my SQL is that it's TCP-based and you cannot open sockets, okay? But despite that, the engine can actually be portaled into Web Assembly.