Ditto 4.13.1
Loading...
Searching...
No Matches
DittoSDK.DittoSync Class Reference

Provides access to sync related functionality of Ditto. More...

Public Member Functions

void Start ()
 Starts all network transports.
void Stop ()
 Stops all network transports.
DittoSyncSubscription RegisterSubscription (string query, Dictionary< string, object > arguments=default)
 Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a SELECT query, otherwise a DittoQueryNotSupportedException will be thrown.

Protected Member Functions

override void Dispose (bool disposing)

Properties

IReadOnlyCollection< DittoSyncSubscriptionSubscriptions [get]
 Gets all currently active sync subscriptions.
bool IsActive [get]
 Gets a value indicating whether or not sync is active. Use Start() to activate and Stop() to deactivate sync.

Detailed Description

Provides access to sync related functionality of Ditto.

Member Function Documentation

◆ RegisterSubscription()

DittoSyncSubscription DittoSDK.DittoSync.RegisterSubscription ( string query,
Dictionary< string, object > arguments = default )
inline

Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a SELECT query, otherwise a DittoQueryNotSupportedException will be thrown.

Parameters
queryA string containing a valid query expressed in DQL.
argumentsA dictionary of values keyed by the placeholder name without the leading :
Example:
new Dictionary<string, object>() { { "mileage" , 123 } }
Returns
An active DittoSyncSubscription for the passed in query and arguments. You'll have to keep it to be able to cancel the sync subscription. Otherwise it will remain active until the owning Ditto object goes out of scope.
Exceptions
DittoStoreExceptionCan throw a DittoStoreException. For more granular exception handling check the following subtypes:

◆ Start()

void DittoSDK.DittoSync.Start ( )
inline

Starts all network transports.

The default network configuration can be modified via Ditto.TransportConfig

Performance of initial sync when bootstrapping a new peer can be improved by calling Ditto.DisableSyncWithV3 before calling Start. Only do this when all peers in the mesh are known to be running Ditto v4 or higher.

Exceptions
DittoExceptionThrown if the Ditto instance hasn't been activated by a successful call to SetOfflineOnlyLicenseToken.

◆ Stop()

void DittoSDK.DittoSync.Stop ( )
inline

Stops all network transports.

You may continue to use the Ditto store locally but no data will sync to or from other devices.