Hello,
In our CB setup, we have users having multiple devices that connect with the same SGW user. We use the offline feature to let users working… offline. But we need to prevent them to create some documents on devices which are outdated from sync pov.
Maybe a list of devices the user have to connect on his account and the date of the last sync for each of them.
Did you already implement such features ?
Do you poll on CBLReplicator_Status()
Do you use the CBLReplicatorChangeListener() ?
Or server side, in SyncGateway, did you already implement smth that could list devices/hostnames for a given SGW user and for each of those device the timestamp of the last complete sync ?
My issue is that a sync gateway user is using multiple devices and we want to give him a way realised that some of his devices have outdated and unsynced data.
Here is a concrete use case :
A doctor is doing home visit to a patient on a location where he has no Internet connexion, then he works offline. He used its smartphone to bill the patient. A bill document is created and stored in cblite… and waiting for next sync to be uploaded in Couchbase central and having following business process on bill document.
But for some reason (forgotten/lost smartphone) the doctor do not sync again its smartphone device for a while… and he gets back to an other device (desktop at office), and having his bill missing, he create it again.
And lastly the smartphone get synced again, ended on having 2 different bills documents for the same act.
There are many others bugs cases that could be prevented if we could give more awareness of unsynced devices.
Yes.
The doctor created conflicting revisions of a document. There is absolutely no automatic way of resolving that conflict: The doctor said two things and it is not reasonable for a machine to decide which of the things she said is correct.
Couchbase Lite includes a custom conflict resolution feature. When it discovers conflicting version of a document it presents them both to client code. The client code can do anything it wants with them… including present them (in this case) to the doctor, to choose. The resolved document is then stored in the database.
Well our issue is not about conflicting documents, but missing documents in some given devices. Missing documents that have been created offline in other devices that have not been synchronised since a while.
Then we would like to have for each sync gateway users list of used devices and the date of the last connection to SGW.
If the doctor (re)created exactly the same document that did not conflict with the existing document, and a custom conflict resolution determined it was the same - would there still be an issue?
ok sorry, I did not choose the best use case.
Let me try an other :
Practitioner made a bill offline, stored in cblite, and forgot to sync it (For instance, he keeps air plane mode).
But he must synchronised its bills to have them uploaded to the health insurance organism within a maximun delay (1 month).
How could we track for each SGW user all its devices with the last synchronised date ?
Hmmm… This is a very different question from the one I understood, previously. You would like a log of devices that have connected to the SG and when they connected?
I don’t have an immediate answer. Let me look into it.