addDocumentReplicationListener

Adds a document replication event listener.

The changes will be delivered on the main thread for platforms that support it: Android, iOS, and macOS. Callbacks are on an arbitrary thread for the JVM, Linux, and Windows platform.

According to performance optimization in the replicator, the document replication listeners need to be added before starting the replicator. If the listeners are added after the replicator is started, the replicator needs to be stopped and restarted again to ensure that the listeners will get the document replication events.

Return

An opaque listener token object for removing the listener.

Parameters

listener

The listener to post changes.

See also


Adds a document replication event listener with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.

According to performance optimization in the replicator, the document replication listeners need to be added before starting the replicator. If the listeners are added after the replicator is started, the replicator needs to be stopped and restarted again to ensure that the listeners will get the document replication events.

Return

An opaque listener token object for removing the listener.

Parameters

context

coroutine context in which the listener will run

listener

The listener to post changes.

See also


Adds a document replication event listener with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.

According to performance optimization in the replicator, the document replication listeners need to be added before starting the replicator. If the listeners are added after the replicator is started, the replicator needs to be stopped and restarted again to ensure that the listeners will get the document replication events.

Parameters

scope

coroutine scope in which the listener will run

listener

The listener to post changes.