Reputation: 873
Hi have to use firestore in offline online synario for chat application. For example some time user send message to other user but there is no internet connection. But just when user switched on internet connection message should instantly sync into data based. Its working in firebase but don't know how it work in firestore.
Upvotes: 1
Views: 4262
Reputation: 138824
Yes, it work also with Firestore. As the offical documentation says,
Cloud Firestore 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. You can write, read, listen to, and query the cached data. When the device comes back online, Cloud Firestore synchronizes any local changes made by your app to the data stored remotely in Cloud Firestore.
To be more clear, every client that is using a Firestore database and sets PersistenceEnabled
to true
, maintains it's own internal (local) version of the database. When data is inserted/updated, it is first written to this local version of the database. As a result, all writes to the database will trigger local events immediately, before any data has even been written to the server. This means that the app will remain responsive regardless of Internet connectivity.
So, feel free to use Firestore offline capabilities.
Upvotes: 3