Skip to main content

Monitoring Transport Conditions

If syncing over Bluetooth LE is a critical part of your application you may want to warn the user if they are missing the permission or if the hardware is disabled. Ditto will help you by reporting conditions via a delegate or callback object.

First, while configuring Ditto, assign a delegate or a callback to receive notifications.

// Setting up inside a ViewControllerditto = Ditto()ditto.delegate = selfditto.setLicenseToken("...")try! ditto.tryStartSync()

Now you can observe real time changes to the transport conditions:

const transportConditionsObserver = ditto.observeTransportConditions((condition, source) => {    console.log(condition, source)})