I have a question about a problem I’m facing but I’m not sure about how to solve it. I am creating an application that should work as a PWA, so also work offline on phones for example.
My first approach was to solve this with GroundDB and load all the important data when first loading the app through subscriptions. But that turned out to be a bad idea because it puts a high load on the server when I’m online because all the publications are kept in memory (if I understand it correctly).
I would like to implement the offline strategy “Cache then Network” (https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-then-network). So when loading the app first it displays what’s in the cache and if I’m connected to the server, update the data in the background and display the updated data when it’s loaded.
So now I suspect that for this to work somehow I can’t use the Meteor PubSub system.
My plan so far is: the data should be saved in the IndexedDB in the browser so when I load the app a client side collection is filled with the data from the IndexedDB. If I’m online then it also should check the server for new data (without downloading the full data set again, just the data that’s new and that has changed).
But at the moment I’m unsure about how to implement that. And also I have other questions about things that follow, like how to sync data between client and server when something has changed? There’s the Background Sync API but that’s only implemented in Chrome and Chromium browsers at the moment.
I’m pretty new to PWAs so I’m not sure how I could implement something like this, especially with Meteor.
Is this possible somehow? Does anybody have any idea how this could be implemented? Any tips? Or am I completely wrong somewhere? Or are there alternatives/other ideas?
Thanks in advance!