SG-Replicate and sequence numbers

I’m not understanding the handshake part, is this handled by the couchbase lite library or by the SG? The reason I ask is because we are using PouchDB to connect to the SyncGW and I want to understand whether this will still work correctly…

Ah, You are referring to PouchDB client. Would have helped to clarify that upfront. I am not familiar with how PouchDB manages replications across target endpoints . You should look up PouchDB documentation. As far as Sync gateway compatibility with PouchDB, check out this post

Aside : What I described is for Couchbase Lite replicating with Sync Gateway. A high level overview of web sockets replication protocol is documented here. Note that the 2.o version of the protocol is different from the HTTP based version in CBM 1.x (which was compatible with CouchDB protocol used by PouchDB)