SubscriptionSet
A subscription set is an immutable view of all current Subscriptions for a given Realm that has been configured for Flexible Sync.
Flexible Sync is a way of defining which data gets synchronized to and from the device using RealmQuerys. The query and its metadata are represented by a Subscription.
A subscription set thus defines all the data that is available to the device and being synchronized with the server. If the subscription set encounters an error, e.g. by containing an invalid query, the entire subscription set will enter an SubscriptionSetState.ERROR state, and no synchronization will happen until the error has been fixed.
If a subscription is removed, so is the corresponding data, but it is only removed from the device. It isn't deleted on the server.
It is possible to modify a subscription set while offline, but a modification isn't accepted by the server before BaseSubscriptionSet.state returns SubscriptionSetState.COMPLETE, which requires that the device has been online.
It is possible to wait for the subscription set to be synchronized with the server by using waitForSynchronization.
Properties
If state returns SubscriptionSetState.ERROR, this method will return the reason. Errors can be fixed by modifying the subscription accordingly and then call SubscriptionSet.waitForSynchronization.
The current state of the SubscriptionSet. See SubscriptionSetState for more details about each state.
Functions
Find the subscription with a given name.
Find the first subscription that contains the given query. It is possible for multiple named subscriptions to contain the same query.
Refresh the state of the subscription set, so it reflect the latest underlying state of the subscriptions.
Modify the subscription set. If an exception is thrown during the update, no changes will be applied. If the update succeeds, this subscription set is updated with the modified state.
Wait for the subscription set to synchronize with the server. It will return when the server either accepts the set of queries and has downloaded data for them, or if an error has occurred.