ajaygopal07
ajaygopal07

Reputation: 150

How does Couchbase Sync Gateway get Couchbase Server changes?

What mechanism does Couchbase Sync Gateway use for getting the database changes in the couchbase server.

  1. Does it do a long Poll or create a websocket connection ?
  2. Or does is frequently invokes Couchbase server REST API ? If so then which REST API and what are the queries that it sends in the HTTP request for that REST API?

Upvotes: 2

Views: 405

Answers (2)

ajaygopal07
ajaygopal07

Reputation: 150

After some Research I found out the following points.

1) sync_gateway first establishes a tcp connection with the couchbase server to port 8091 and over that tcp connection it sends http GET request to invoke the REST API /pools ad /pools/default.

2) After that whenever there is a document change initiated by user , sync_gateway send tcp packet with data field asking for the user information and the document information that is being changed .

3) Now sync_gateway sends another TCP packet with revised revision of the packet and gets a response from couchbase server that document has been revised.

4) All these conversation happens using TCP PSH ACK packets. So there are no HTTP packets flowing . Only TCP servers communicating both sides.

Upvotes: 1

DaveR
DaveR

Reputation: 9640

Neither - it uses DCP (the same underlying protocol used by replication and XDCR) to subscribe to updates from Couchbase Server.

Upvotes: 2

Related Questions