Couchbase Server5.5 + Sync Gateway + Couchbase Mobile 2.x + Pouchdb possible?

I’m looking to create a mobile app for Android in Xamarin that syncs with a db and a web front-end to my server using something like pouchdb. Bother would talk to the same couchbase server via the sync gateway. Is this combination possible? It’s a little hard to tell from all the documentation whether this combination is possible.

1 Like

My response addresses more than just your specific question because I want to ensure you have the chance to review all your options depending on your needs

Are you looking for offline storage within your browser app ? If not, here are some options

  • you can interact with the Sync Gateway directly through the REST API . You can setup a a longpoll listener for changes feed, create Sync Gateway users etc. If you want to sync changes from client, you have to manually handle writing the documents.
  • You can also build out your front end using any suitable framework and a web backend that can use any of our existing server SDKs to interface with Couchbase server. Changes made from the SDK app and mobile clients will be synced with each other through shared bucket access capability. Here is an example. Of course, you cannot subscribe to Sync gateway changes feed etc

If you are looking for offline storage capabilities within your browser app, then here are the options -

  • You can use HTML5 offline storage and use the Sync Gateway REST API longpoll API to listen to changes. Of course, that works if you are looking to sync from the server. If you want to sync changes from client, you have to manually handle writing the documents.
  • PouchDB is an option if you need offline storage support and this is the state of things -
    • Sync Gateway 2.0 is compatible w/ PouchDB/CouchDB to the extent that the 1.x version of Sync Gateway was.
    • Caveats
      • There are a couple of known issues with the compatibility but it should be possible to work around those easily.
    • We do not test compatibility with PouchDB. So there may be issues in addition to the ones that were discussed above that we may not be aware of.
    • We cannot guarantee that there won’t be changes in Couchdb/PouchDB in future that break this compatibility . Essentially, we do not strive to be compatible with the protocol. So you have to be cognizant of this every time you upgrade PouchDB .

Essentially, if you must decide to use PouchDB best way forward is for you to do a quick PoC and be aware of potential implications during upgrade.

1 Like

I will essentially have real time events fed by sensors that the mobile users will have to respond to (in real time). My current thinking is that these sensors will either directly push data to the server or possibly go through an app server located on site. The web front-end should also be able to monitor these events as they happen and provide additional administrative capabilities which is why I am looking for a real time sync for the web front-end too.

So it looks like you are looking for sync but no offline storage in your web app, so you can probably consider the _changes feed REST API approach

On related note FYI - This is a gist of a node.js app that picks up changes feed and plots it using