DatasyncService

class DatasyncService : WebcomAbstractService, Closeable

The WebcomAbstractService that makes it possible to interact in real time with the data of a Webcom application.

This service mainly provides ways to get/set/update the data and to subscribe to them in order to be notified in real time when they change. Instances of DatasyncService must be built using the WebcomApplication.datasyncService property.

Functions

Link copied to clipboard
fun cleanLongTermSubscriptions()

Clears all the ongoing long term subscriptions associated with the currently authenticated user from the client local storage.

Link copied to clipboard
fun cleanOfflineCache()

Stops maintaining updates of data previously watched by canceled subscriptions within the local cache. In other words, cleans from cache all data that are not currently watched by an active subscription.

Link copied to clipboard
fun createManager(policy: CancelationPolicy = CancelationPolicy.KeepUpdatingWhenImplicit): DatasyncManager

Asks the DatasyncService to create a new DatasyncManager instance. The passed policy controls how the cached data is managed when subscriptions to data events (to be created using the DatasyncNode.subscribe method) are canceled.

Link copied to clipboard
fun deleteManager(manager: DatasyncManager)

Asks the DatasyncService to delete a DatasyncManager instance.

Link copied to clipboard
fun getLongTermSubscriptions(): List<LongTermSubscription>

Retrieves the list of the ongoing long term subscriptions associated with the currently authenticated user, which are stored in the client local storage. Long term subscriptions result from invoking either Subscriber.subscribeThroughWebhook or Subscriber.subscribeThroughPushNotification methods.

Link copied to clipboard
fun isPresent(value: PresenceState?): Boolean

Indicates whether a value previously set by the startPublishingMyPresence method means that a user is present.

Link copied to clipboard
fun offlineCache(): String

Retrieves the content of the current local cache content. It can then be saved somewhere and restored later at next app startup using WebcomConfiguration.offlineCache.

Link copied to clipboard
fun startPublishingMyPresence(path: String)

Starts maintaining a value at a given path that indicates in real time whether the user of the underlying WebcomApplication is connected and authenticated.

Link copied to clipboard
fun stopPublishingMyPresence()

Stops maintaining the indicator of the user presence, previously started by the startPublishingMyPresence method.

Properties

Link copied to clipboard
var isConnectionEnabled: Boolean

Indicates whether the DatasyncService tries to establish connection to the Webcom back end.

Link copied to clipboard
val state: DatasyncState

Synchronously returns the current state of this DatasyncService.