We are replicating specific channels in Android with the next code:
URL url = new URL(“https://example.com/mydatabase/”);
db.createPullReplication(url);
List channels = new ArrayList();
channels.add(“sales”);
channels.add(“inventory”);
pull.setChannels(channels);
Everything works fine, we acan do specific push and pull replications trough specific channels.
We want to do the same on Phonegap, but the REST API documentation does not mention how to set specific channels to replicate.
I think that under the hood, CBL uses a channels parameter in the url to specify a particular channel to pull from.
I don’t know if the _replicate endpoint on the Listener API has a params field in the JSON that would make it possible to specify this (I know there’s one for headers but not sure about the query string). @jens Is there a field in the JSON to do this from the Listener API?
I found a Google Groups (Pull filter / Unknown filter) reference to filtered replication in phonegap , but it seems like an old or missed reference in actual documentation. Can you confirm we can still use such method in Couchbase Lite and Sync Server 1.1.0?
In the REST API, use a filter parameter with value sync_gateway/bychannel, and a channels parameter whose value is the channel names separated by commas.
(The channels property in the native API is actually just a shortcut that does exactly this under the hood.)