DatasyncService

class DatasyncService : WebcomAbstractService

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

cleanOfflineCache
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.

createManager
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.

isPresent
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.

offlineCache
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.

startPublishingMyPresence
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.

stopPublishingMyPresence
Link copied to clipboard
fun stopPublishingMyPresence()

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

Properties

isConnectionEnabled
Link copied to clipboard
var isConnectionEnabled: Boolean

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

state
Link copied to clipboard
val state: DatasyncState

Synchronously returns the current state of this DatasyncService.