Dear all,
I have dynamic channels, and I would like to let my users decide which ones they should subscribe to. So in my document i have something like the following:
{
"channels:" : ["company--1", "company2"]
}
and on sync gateway, I have the following config:
{
"logging": {
"console": {
"log_keys": ["*"]
}
},
"databases": {
"mybucket": {
"server": "http://localhost:8091",
"bucket": "test",
"username": "test",
"num_index_replicas": 0,
"password": "couchbase",
"enable_shared_bucket_access": true,
"users": {
"myuser": {"password": "mypassword" } },
"allow_conflicts": false,
"revs_limit": 20
}
}
}
and finally, on my android app, the following config:
URI url = null;
try {
url = new URI(mSyncGatewayEndpoint);
} catch (URISyntaxException e) {
e.printStackTrace();
}
ReplicatorConfiguration config = new ReplicatorConfiguration(database, new URLEndpoint(url));
config.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PUSH_AND_PULL);
config.setContinuous(true);
config.setChannels(Arrays.asList("company--1"));
config.setAuthenticator(new BasicAuthenticator("myuser", "mypassword"));
Replicator replicator = new Replicator(config);
replicator.addChangeListener(new ReplicatorChangeListener() {
@Override
public void changed(ReplicatorChange change) {
Log.i("Replication Comp Log", "new document");
if (change.getReplicator().getStatus().getActivityLevel().equals(Replicator.ActivityLevel.IDLE)) {
Log.e("Replication Comp Log", "Schedular Completed");
}
if (change.getReplicator().getStatus().getActivityLevel().equals(Replicator.ActivityLevel.STOPPED)
|| change.getReplicator().getStatus().getActivityLevel().equals(Replicator.ActivityLevel.OFFLINE)) {
// stopReplication();
Log.e("Rep schedular Log", "ReplicationTag Stopped");
}
}
});
replicator.start();
However, no document is being sent to mobile, do you have any idea of what is wrong?