registerSubscription

fun registerSubscription(query: String, arguments: Map<String, Any>? = null): DittoSyncSubscription

Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The given query must be a SELECT query, otherwise a DittoError.StoreError with DittoError.StoreErrorReason.QueryNotSupported is thrown.

Return

An active DittoSyncSubscription for the given query and arguments that can be used to close the subscription. Otherwise, the subscription will remain active until the owning Ditto instance goes out of scope.

Since

4.5.0

Throws

if there is a problem creating or registering the subscription.