Reputation: 386
Google has launched Google Cloud Firestore. Just as they says... "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud Platform. Like Firebase Realtime Database, it keeps your data in sync across client apps through realtime listeners and offers offline support for mobile and web".
The question is...
In the application I am thinking about, needs that everyone to have data perfectly sync between devices (web and mobile). Ok, Firestore looks perfect for that. * But what if my application also needs to sync between devices in a local network. Let's suppose if the internet connection is gone (whatever reasons...)*. Does anyone could give me a direction how could it be made using Google Cloud Firestore (I don't mean the code). I use node for web application and Android for mobile.
Upvotes: 0
Views: 1338
Reputation: 138834
Cloud Firestore
as well as Firebase Reatime Database supports offline data persistence
. This feature caches a copy of the Cloud Firestore data that your app is actively using, so your app can access the data when the device is offline. So, if you are using:
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
It means that Firestore will create a local copy of your database on your device, which in turn means that you'll be able to query your the database even if you are offline. So every change that is made while you are offline, will be updated on Firebase servers once you are back online. Unfortunately this local copy of your database cannot exist elsewhere than on your device. It cannot be hosted in a local network. Also all CRUD operation can be done only on the database which are hosted on users device.
Another thing to note, is that once the Internet connectivity is reestablished, you'll receive the appropriate current server state. The Firebase client synchronizes that data with the Firebase servers and with other clients that are using the same database. So, as a conclusion, in order to keep all your devices from a local network synced, you need to have internet access.
Upvotes: 1