Understanding continous push replication - iOS application

I have gone through the replication algorithm,it fetches the _local special document from target db ,identifies the revisions not available in the target db and finally sending the bulk revisions of documents not exist in the target db. this flow i can understand by enabling the logs.

My POC testing results (Replication is set to continuous,using latest couchbase lite and listener 1.3.1),

replication works as expected as above,once its discover the peer in the network(tested using Wifi network) using Bonjour protocol,transfer is happening

Later if i do any operations, how does the other devices know the changes happened or how the replication will work for this usecase?

If you’re using push replication, the replicator knows the local database has changed because it gets a local database-changed notification. Then it wakes up and pushes the change to the target.

You may be interested in a small framework I wrote for P2P replication.

Thanks jens. I have found out the problem.I did not observe my database for changes.Thought that will be taken care automatically, by setting continuous property to “YES”.

Now i am able to sync the data between the devices, but very frequently replication fails with the error saying "Error fetching last sequence: NSURLError[-999]"

Please find below the syncverbose logs for the same,

Nov 17 13:00:48 A6 PushApp[3506] : __71-[SyncHandler startCouchbaseListenerWithServiceType:forDatabase:]_block_invoke [Line 57] changes happened to my database
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLReplication[to http://Ipadmini007.local.:55046/couchdb]: offline, progress = 0 / 0, err: (null)
Nov 17 13:00:48 A6 PushApp[3506] : -[SyncHandler showProgressForReplication:completedRepl:totalRepl:] [Line 434] Replication: kCBLReplicationOffline:1
Nov 17 13:00:48 A6 PushApp[3506] : Document ‘27313_CCNotes_231605350001376E’ changed.
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb] STARTING …
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb]: Going online
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb] Progress: set active = 1
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb]: postProgressChanged (0/0, active=1 (batch=0, net=1), lastSeq=(null), online=1, error=(null))
Nov 17 13:00:48 A6 PushApp[3506] : Sync: <CBLRemoteSession: 0x13f99c830>: GET /couchdb/_local/1e3ae20aa7ce178d053d0f531f80dc8bf82c8d5a
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: CBLRemoteJSONRequest[GET http://Ipadmini007.local.:55046/couchdb/_local/1e3ae20aa7ce178d053d0f531f80dc8bf82c8d5a]: Starting…
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLReplication[to http://Ipadmini007.local.:55046/couchdb]: active, progress = 0 / 0, err: (null)
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: CBLRemoteSession starting CBLRemoteJSONRequest[GET http://Ipadmini007.local.:55046/couchdb/_local/1e3ae20aa7ce178d053d0f531f80dc8bf82c8d5a]
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb] STOPPING…
Nov 17 13:00:48 A6 PushApp[3506] : -[SyncHandler showProgressForReplication:completedRepl:totalRepl:] [Line 423] replication is active completed ChangesCount: 0 total changesCount: 0
Nov 17 13:00:48 A6 PushApp[3506] : -[SyncHandler netServiceDidStop:] [Line 294] Ipadmini007 is stop service
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: Stopping 1 remote requests
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: CBLRemoteJSONRequest[GET http://Ipadmini007.local.:55046/couchdb/_local/1e3ae20aa7ce178d053d0f531f80dc8bf82c8d5a]: Stopped
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb]: Error fetching last sequence: NSURLError[-999]
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: CBLRemoteSession done with CBLRemoteJSONRequest[(null) (null)]
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb] Progress: set active = 0
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb]: postProgressChanged (0/0, active=0 (batch=0, net=0), lastSeq=(null), online=1, error=(null))
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb] STOPPED
Nov 17 13:00:48 A6 PushApp[3506] : Replication: CBLRestPusher[http://Ipadmini007.local.:55046/couchdb] took 0.133 sec; error=(null)
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: CBLRemoteSession closing
Nov 17 13:00:48 A6 PushApp[3506] : RemoteRequest: CBLRemoteSession closed
Nov 17 13:00:48 A6 PushApp[3506] : Sync: CBLReplication[to http://Ipadmini007.local.:55046/couchdb]: stopped, progress = 0 / 0, err: (null)
Nov 17 13:00:48 A6 PushApp[3506] : -[SyncHandler showProgressForReplication:completedRepl:totalRepl:] [Line 427] Replication: kCBLReplicationStopped

i googled for this issue, but could not find any solution for this issue.Is this because multiple requests?.