Replication not works from Server to Mobile


#1

Hello

I have problem with both side replications. I have Couchbase server and Couchbase Sync Gateway running on PC. Then I have simple Android Aplication made from example GlocerySync. I need to set synchronization to one database. To database I need access from Android SDK and also from server Rest Api or Node.js library. From Android the replication works, but when I create new document using Rest Api or Node.js in shadowing bucket, it replicates to main bucket but not into Android.

Here is config.json for Gateway:

{
"interface": ":4984",
"adminInterface": ":4985",
"log": ["CRUD", "CRUD+", "HTTP", "HTTP+", "Access", "Cache", "Shadow", "Shadow+", "Changes", "Changes+"],
"databases": {
    "testovaci": {
        "server": "http://localhost:8091",
        "bucket": "test",
        "include_docs":true,
        "sync": `function(doc) {channel(doc.channels);}`,
        "users": {
            "GUEST": {
                "disabled": false,
                "admin_channels": ["*"]
            }
        },
        "shadow": {
             "server": "http://localhost:8091",
             "bucket": "shadow"
        }
    }
}
}

Here is main code from Android:

                 // create a manager
		 Manager manager = new Manager(new AndroidContext(this),
					Manager.DEFAULT_OPTIONS);
		 String dbname = "hello";
   
		 // create a new database
		 Database database = manager.getDatabase(dbname);

			URL syncUrl = new URL("http://192.168.92.12:4984/testovaci");
			
			Replication pullReplication = database
					.createPullReplication(syncUrl);
			pullReplication.setContinuous(true);

			pullReplication.addChangeListener(new Replication.ChangeListener() {
			    @Override
			    public void changed(Replication.ChangeEvent event) {
			        Replication replication = event.getSource();
			        Log.e("testApp","Replication start");
			        if (!replication.isRunning()) {
			            String msg = String.format("Replicator %s not running", replication);
				       Log.e("testApp",msg);
			        }
			        else {
			            int processed = replication.getCompletedChangesCount();
			            int total = replication.getChangesCount();
			            String msg = String.format("Replicator processed %d / %d", processed, total);
					       Log.e("testApp",msg);
			        }
			    }
			});
			pullReplication.start();

Please help


#2

Hello @Cronoss,

The Couchbase Server Node.JS API uses libcouchbase which talks binary memcache and therefore not REST so the document model will not work together.

More info:
http://developer.couchbase.com/mobile/develop/guides/sync-gateway/wcbs/bucket-shadowing/index.html

Are you able to see a new revision being created?