Data Sync

Customizing Transport Configurations

This article provides instructions on explicitly configuring your Ditto instance to listen for connections on a specific port and to connect to remote instances using a host (IP) and port.

Although Ditto automatically attempts to connect to other instances on the Local Area Network (LAN), Bluetooth Low Energy (LE), and Apple Wireless Direct Link (AWDL), supplying a DittoTransportConfig does not enable this feature by default.

Rather, you manually enable peer-to-peer connections using EnableAllPeerToPeer().

Disabling Transports



Swift
Kotlin
JS
Java
C#
C++
Rust


Configuring Additional Settings

If you need additional connection configurations for the current Ditto instance, configure it to listen for connections on a specific port and to connect to remote instances using a host (IP) and port:

1

Before calling startSync(), create a DittoTransportConfig object with the desired settings.

2

Using the ditto.SetTransportConfig API method, set the created object on your Ditto instance.

3

Call the startSync method on your Ditto instance to initiate sync with the configured settings.

Syncing with Big Peer


Swift
Kotlin
JS
Java
C#
C++
Rust


Observing Peers​


Swift
Kotlin
JS
Java
Rust


pseudocode


Connecting to Remote Small Peers


Swift
Kotlin
JS
Java
C#
C++
Rust


Initializing WebSocket Connections

Ensure WebSocket connections are discoverable across peers within your local network:

Swift
Kotlin
JS
Java
C#
C++
Rust


Listening for Connections


Swift
Kotlin
JS
Java
C#
C++
Rust



Combining Multiple Transports


Swift
Kotlin
JS
Java
C#
C++
Rust


Monitoring Conditions


Swift
Kotlin
JS
Java
C#
C++
Rust