Skip to content

Replication Custom Properties

Jens Alfke edited this page Aug 21, 2015 · 2 revisions

CBLReplication has a property called customProperties that provides an informal way to customize the behavior of the replicator. In the REST API you can use the same properties simply by adding them to the JSON body of the POST request to /_replicate.

Here are the properties recognized by the replicator, and what their values mean.

Key Value Description
connection_timeout milliseconds Timeout for network requests, overriding the default value of 60000.
heartbeat milliseconds How often a pull replication's server push (_changes feed) should send a byte down the socket to keep it alive. (Default is 3000000, or 5 minutes.)
poll milliseconds If set, a continuous pull replication will periodically poll for changes (at the given interval) instead of leaving a socket open. Increases latency but reduces number of open sockets on the server.
network string If set to "WiFi", the replication will only run over a WiFi network, not cellular. If set to Cell, the reverse happens.
pinnedCert string or NSData If you store an X.509 certificate here (either the full raw DER data, or a SHA-1 digest) the replicator will only connect to an SSL server that has that exact certificate. This is a security measure that can thwart some forms of SSL spoofing. In native code it's most convenient to set the value as an NSData object, but from the REST API you can use a hex-encoded string.
remoteUUID string In some cases, as in peer-to-peer, a server may not have a fixed URL. However, the replicator stores its state (or "checkpoint") as a persistent value keyed off of that URL, so if the URL changes the replicator will forget its state and have to start over, greatly slowing the replication. You can avoid this by defining your own stable unique identifier for this particular server and setting it as the remoteUUID property; if so, it will be used instead of the URL as the key for storing the checkpoint.
reset anything The replicator will reset its state and act as though it's never synced with the remote database before. This will be slower, but it has some potentially useful effects, like re-downloading all documents that had been purged locally.
websocket boolean Set this to false to disable the use of WebSockets for the _changes feed. This can be used as a workaround for issues with some proxies/gateways that don't support WebSockets.

(Reference: CBL_Replicator.h)