SyncClient

interface SyncClient

This is a central entity used to work with Sync.

After creating a SyncClient you can open, create and modify SyncDocuments, SyncLists, SyncMaps and SyncStreams.

Example:

val syncClient = runCatching { SyncClient(context) { requestToken() } }.getOrElse { t ->
val errorInfo = (t as? TwilioException)?.errorInfo
Log.w(TAG, "Error creating SyncClient: $errorInfo")
return
}

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Events

This interface defines scope of Flows for collecting SyncClient events.

Properties

Link copied to clipboard
abstract val connectionState: <Error class: unknown class>

Current transport state.

Link copied to clipboard
abstract val documents: Documents

Provides methods to work with SyncDocuments.

Link copied to clipboard

Provides scope of Flows objects to get notified about events.

Link copied to clipboard
abstract val lists: Lists

Provides methods to work with SyncLists.

Link copied to clipboard
abstract val maps: Maps

Provides methods to work with SyncMaps.

Link copied to clipboard
abstract val streams: Streams

Provides methods to work with SyncStreams.

Functions

Link copied to clipboard
abstract fun shutdown(logout: Boolean = false)

Cleanly shuts down the SyncClient when you are done with it. After calling this method client could not be reused.

Link copied to clipboard
inline fun <R> SyncClient.use(block: (SyncClient) -> R): R

Executes the given block function on SyncClient and then shuts it down correctly whether an exception is thrown or not.