Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase SDK, offline data storage with the option to sync at a later date

Tags:

ios

firebase

When using Firebase in an iOS app I would want to give the users the option to sync their data into the Firebase cloud or just keep everything local. I've seen that Firebase has introduced the option in their SDK to go offline and keep the data from syncing online but I'm not sure about the intent of the feature.

//Keep data local.
[Firebase defaultConfig].persistenceEnabled = YES;
self.firebase = [[Firebase alloc] initWithUrl:kFirechatNS];
[Firebase goOffline];

From the documentation it seems that the goOffline(), and offline mode in general, is build to handle temporary periods where the device is offline, and sync data back in to the cloud as soon as the device becomes online again. Would the Firebase offline mode be capable of handling a "permanent offline" scenario? Or would forcing Firebase to go "permanently offline" lead firebase to just accumulate more and more "meta data" for a never occurring future sync to the cloud? Or discard old data at some point? Or run out of offline cache disk space when a max cache size is reached ?

like image 401
Oysio Avatar asked Sep 25 '15 18:09

Oysio


1 Answers

I got answer from Firebase support:

While you can use goOffline() to force the client offline for a long time, performance will deteriorate over time. The Firebase clients will queue intermediate state changes, instead of updating the stored state as the server does.

like image 58
Oysio Avatar answered Sep 28 '22 12:09

Oysio