Hi,
I need to track the possible sync outdated issues, so if the device has not been synced for a while (due to a network issues or CouchDB server unavailability) I need to show a sign on the screen indicating that its local database is outdated. I use the next notification to track the replication status:
NSNotificationCenter.defaultCenter().addObserver(self,
selector: “replicationProgress:”,
name: kCBLReplicationChangeNotification,
object: replication)
so inside of the method:
if pull.status == CBLReplicationStatus.Offline {
// here I write the current timestamp that it is offline and show the sign for the user on the screen
}
and I remove the “out of date” sign once the replication changes back to .Idle like:
if pull.status == CBLReplicationStatus.Idle { // etc…
this works great when I simulate a connection drop via turning off the WiFi on the device, however when I am trying to simulate database server connection lost (not the network) by stoping CouchDB server manually the Couchbase Lite (iOS) returns the next warning:
WARNING: CBLSocketChangeTracker[0x7c877660 pbc_dev]: Longpoll connection closed (by proxy?) after 22.9 sec
and the CBLReplicationStatus is not changing to Offline like when I turn of WiFi with my tests.
How can I catch a “Longpoll connection closed” error? Why CBLReplicationStatus is not changing to .Offline automatically?