ditto / live.ditto / Ditto

Ditto

class Ditto

Ditto is the entry point for accessing Ditto-related functionality.

Parameters

dependencies - the dependencies required by the SDK to be initialised.

identity - the identity to be used to represent the connected client.

Constructors

<init>

Creates a Ditto instance.

Ditto(dependencies: DittoDependencies, identity: DittoIdentity = DittoIdentity.Development())

Properties

activated

flag indicating whether or not the SDK has been activated with an access license.

var activated: Boolean

callback

an optional callback that will be called with lifecycle events relating to the SDK.

var callback: DittoCallback?

sdkVersion

Returns a string identifying the version of the Ditto SDK.

val sdkVersion: String

siteID

the site ID component of the identity in use.

val siteID: BigInteger

store

provides access to the SDK's store functionality.

val store: DittoStore

Functions

clearSiteID

Clears the cached site ID, if one had been cached.

fun clearSiteID(): Unit

finalize

fun finalize(): Unit

generateRandomSiteId

fun generateRandomSiteId(): BigInteger

getTransportDiagnostics

Request bulk status information about the transports. This is mostly intended for statistical or debugging purposes.

fun getTransportDiagnostics(): DittoTransportDiagnostics

observePeers

Request information about Ditto peers in range of this device.

fun observePeers(handler: (List<DittoRemotePeer>) -> Unit): DittoPeersObserver
fun observePeers(callback: DittoPeersObserverCallback): DittoPeersObserver

refreshPermissions

Provide a hint to Ditto that app permissions may have changed.

fun refreshPermissions(): Unit

setAccessLicense

Activate a Ditto instance by setting an access license. You cannot interact with Ditto before you have activated it.

fun setAccessLicense(license: String): Unit

setTransportConfig

fun setTransportConfig(config: DittoTransportConfig): Unit

startSync

Starts the network transports. Ditto will connect to other devices and synchronize data with them where appropriate.

fun startSync(): Unit

stopSync

Stops all network transports.

fun stopSync(): Unit

Companion Object Properties

deviceName

Configure a custom identifier for the current device.

var deviceName: String