3 ms·
It'd be nice to know how it determines which writes to use if two devices are offline, have conflicting data, and try to write to the same database after they'r
by knicholes 11y ago
It'd be nice to know how it determines which writes to use if two devices are offline, have conflicting data, and try to write to the same database after they're both connected.
Vector clocks? Last write wins? Conflict resolution functions?
- jonnydee 11y agoFirebase (even without offline persistence) uses a simple last write wins strategy. This will work well with most apps. However, if this is not enough, our security rules allow you to have more complex strategies based on client time, for example. Even without offline it really depends on the kind of conflict resolution you want in your app. For complex apps that require merges we recommend to build something like operational transform on top of Firebase (As an example look at Firepad [1]). [1] http://www.firepad.io/ http://www.firepad.io/
- bsaul 11y agoCould you add more detail as to what you mean by "last write" ? Is it the time at which the write was performed locally, or the time at which it was sent to the server ? the difference can be quite large if for example you connect a device after having worked offline with it for a long time.