-
Notifications
You must be signed in to change notification settings - Fork 388
Using Sw-precache with firebase (question) #165
Comments
You can't, really, if you're using the Firebase Web Socket interface. Web Socket calls bypass the service worker completely. If you are using the REST interface, then it's possible to have the service worker intercept those calls, but it's not necessarily going to be the best approach (and it forces you to use REST instead of the realtime API). Instead, what I'd recommend doing is using IndexedDB to handle offline scenarios. Unfortunately, this isn't officially baked into the Firebase JavaScript SDK at the moment, so you'll have to roll your own solution. https://www.youtube.com/watch?v=srdKq0DckXQ is @addyosmani's talk from Google I/O 2016, that goes into some detail on how he accomplished this in a sample app. You can also take a look at the open source code for the Google I/O Web App, which implements IndexedDB queueing for all read and write operations to handle offline scenarios: https://github.com/GoogleChrome/ioweb2016/blob/master/app/scripts/helper/firebase.js |
Hi guys
|
same problem here, the sw is not caching the images on the storage.... |
I am a bit unclear as to how to configure runtime caching option for my SPA so that I can have service worker control calls made to firebase database for data and cache the previously downloaded dynamic data beacuse on refresh the data disappers(when no network) . Any help would be greatly appreciated.
I don't know if its better to use something like redux-persist which saves the last state in memory so state persists through refresh. but the problem with that is if there is a change in data, how would i know?
The text was updated successfully, but these errors were encountered: