Module dittolive_ditto::sync

source ·
Expand description

Use ditto.sync() to access the Sync API of Ditto.

The Sync API can be used to request documents to be synchronized with other peers. Use ditto.sync().register_subscription(...) and provide a DQL query to let Ditto know which documents you’re interested in syncing.

The returned SyncSubscription handle can be used to cancel the subscription with .cancel(), at which point Ditto will stop syncing data for that subscription.

§Example

use dittolive_ditto::prelude::*;

let sync_subscription = ditto
    .sync()
    .register_subscription("SELECT * FROM cars WHERE color = 'blue'", None)?;

// To cancel the sync subscription, use .cancel()
sync_subscription.cancel();

Structs§