Skip to main content

Overview

The real-time end-user transactional data generated by your app can be synced across devices through three different methods:

  • Centralized — A Small Peer device establishes a direct internet-enabled connection to the Big Peer cloud.
  • Decentralized — A Small Peer device establishes a mesh network connection with nearby SmallPeer devices using any and all communication transport types available to them by default.
  • Hybrid — If one or multiple Small Peer devices connected in the mesh network gain access to the internet, not only do those devices with internet access upload their local database to the Big Peer cloud, but each and every nearby offline Small Peer device as well.

For instructions on enabling and disabling transport types, see Transport Configuration.

Supported Transport Types

If available to their device, SmallPeers use the following communication transport types to automatically establish a mesh network with other SmallPeers that are physically close by:

TransportiOSAndroidmacOSWindowsLinuxWeb Browser
Bluetooth Low Energy (BLE)
Apple Wireless Direct Link (AWDL)
Wi-Fi Aware
Wi-Fi Direct
Local Area Network (LAN)
WebSockets
Universal Serial Bus (USB)
  • Already supported in our current releases.
  • Under development and will be released soon.

Intro to the Rainbow Connection

Ditto utilizes a mesh network among connected peers to facilitate data synchronization. This mesh network relies on an advanced peer-to-peer protocol referred to as the multiplexer. The multiplexer plays a crucial role in handling data packet fragmentation and reassembly, as well as determining the fastest transport type available for syncing fragmented data packets across the mesh. Functioning as an intelligent synchronous machine within a mesh connection, Ditto's multiplexer breaks down data packets into smaller fragments. On the receiving end, it reassembles these fragments from various physical connections arriving from various transport types.

The combination of the mesh network and multiplexer creates a connection known as The Rainbow Connection in Ditto.

For a visual overview of supported communication transports and their capabilities, as well as see how Ditto's multiplexer seamlessly manages the intricate task of setting up and sustaining these various transports for your app and devices, watch the following narrated video:

Bluetooth Low Energy

If available, Ditto uses Bluetooth technology to form low-powered and high-distance connections between devices. Bandwidth capacity and distance limitation is determined by the version of Bluetooth© firmware installed on a given Small Peer device, but in general Bluetooth-enabled Small Peers are discoverable when physically located within approximately a 30- to 60-meter range. For instructions on enabling Bluetooth LE on a Linux-enabled system, such as a Raspberry Pi, see Linux & Raspberry Pi.

Once discovered, however, a Bluetooth-based mesh connection can be sustained for further distances:

  • If using Bluetooth version 4.0 classic, point-to-point connections can be sustained up to 80 meters in distance.
  • If using Bluetooth version 5.0 Low Energy (LE), point-to-point connections can be sustained up to 130 meters in distance. Most devices manufactured during or after 2017 are equipped with Bluetooth 5.0 LE.
info

If the Wi-Fi network goes down abruptly, causing a complete loss of connectivity, it can lead to a suboptimal situation where all devices remain in a state of suspended activity, waiting for network connectivity to be restored. To mitigate this, Ditto incorporates keepalive checks that invalidate TCP connections after 4.5 seconds of inactivity. In such cases, Ditto falls back to leveraging the existing Bluetooth LE connections.

Therefore, if you encounter sync delays ranging from 30 to 60 seconds, it indicates that at least one device was already facing difficulties in participating effectively within the Bluetooth LE mesh network. In this case, the root cause is the device's capability to contribute to the Bluetooth LE mesh network rather than the failover mechanism. The presence of the Wi-Fi network was merely concealing this underlying issue.

The following video provides a brief visual overview of how Ditto uses Bluetooth Low Energy (LE) to form low-powered high-distance connections between devices. Note that the distances and bandwidth limitations and capacities illustrated in the video are approximations and vary depending on the Bluetooth© firmware installed on the Small Peer device.

Bluetooth Range and Performance

Although Bluetooth technology is very performant when syncing JSON-like documents, performance wanes when syncing very large attachments of binary data, such as an image.

Bluetooth devices stream data using radio frequency. Since radio frequency is susceptible to radio signal attenuation caused by the exposure to the water and fat contents that make up the human body, when using Bluetooth to transmit data across the mesh, the number of people that are physically present influences point-to-point transmission performance.

Bluetooth Low Energy (LE)' has a bandwidth that enables syncing of up to 20 KB of data within a 1-second interval.

info

Ditto continuously maintains a mesh of TCP connections over Wi-Fi and Bluetooth LE. In the event of a Wi-Fi network disruption, such as the router being disconnected, Ditto does not switch to establishing a BLE connection. Instead, it actively works to sustain the Wi-Fi and BLE mesh connections.

Peer-to-Peer Wifi

This topic provides an overview of Ditto’s unique approach to peer-to-peer Wi-Fi connections, as well the combination of Wi-Fi Direct, Wi-Fi Aware technologies, and, if an iOS or Mac device, Apple Wireless Direct Link (AWDL) for establishing peer-to-peer connections.

Peer-to-peer Wi-Fi enables devices to establish direct, point-to-point connections with each other using a mesh network instead of utilizing a traditional network infrastructure like a router or access point. Each device participating in the mesh network can share and sync data with other devices, allowing them to stay updated and have consistent data across all connected devices.

In addition to standard peer-to-peer Wi-Fi technology, Ditto incorporates its own synchronization protocol to facilitate the data sync process.

By combining peer-to-peer Wi-Fi technology with a custom synchronization protocol, Ditto enables devices to communicate and sync data in a decentralized way so they can exchange data directly, without relying on a central server or internet connectivity. When changes are made to the data on one device, Ditto ensures that those changes are propagated to other devices within the mesh network by utilizing the peer-to-peer Wi-Fi connections.

The following video illustrates Ditto’s decentralized approach to peer-to-peer Wi-Fi connections:

*Note that the maximum distance of a connection can vary depending on the specific peer-to-peer transport type being used.

If a SmallPeer-to-SmallPeer connection is between Apple devices, the Apple Wireless Direct Link (AWDL) transport protocol can be leveraged to establish a mesh network connection and sync data across connected peers.

Apple Wireless Direct Link (AWDL) is most known for powering AirDrop and is only supported on iOS and macOS devices. Apple Wireless Direct Link does not require an internet connection and is capable of communicating as long as the device Wi-Fi settings are turned on.

AWDL Range and Performance

AWDL-enabled connections have a range of up to 35 meters in a point-to-point setup. While Bluetooth-enabled connections can reach much farther distances (up to 80 meters with Bluetooth LE), the bandwidth of AWDL is significantly more powerful than that of Bluetooth.

Wi-Fi Technology for Windows and Android

Ditto supports both Wi-Fi Direct and Wi-Fi Aware standards. Wi-Fi Direct is an open standard that, similar to Bluetooth technology, allows for two devices to connect directly to one another without a router. Wi-Fi Aware is a newer open standard that provides a mechanism for devices to discover and communicate with nearby devices using Wi-Fi technology.

Wi-Fi Aware Range and Performance

Wi-Fi Aware is a new open standard introduced to Android devices, which shares similarities with Apple Wireless Direct Link in terms of distance and bandwidth capabilities. It has been supported at the operating system level since Android 8; however, not all Android manufacturers have enabled it at the hardware level.

Wi-Fi Aware can achieve point-to-point distances of approximately 40 meters. It has the capability to sync 1 gigabyte files in as little as 8 seconds.

In general, most Google Pixel, Samsung, and LG phones built after 2018 can support Wi-Fi Aware. Other devices are also being updated to include Wi-Fi Aware support. To check if your device is capable of supporting Wi-Fi Aware, download Ditto's WiFi Aware Checker on the Google Play Store.

Wi-Fi Direct Range and Performance

Certain Windows 10 devices and the majority of Android devices, specifically those running Android 4 and higher (API Levels 14 and higher), support the Wi-Fi Direct transport type.

When using Wi-Fi Direct for mesh connections, you can experience fast data transmission speeds similar to AWDL AirDrop. For example, a mesh connection established with the Wi-Fi Direct transport type can maintain a range of up to 80 meters. Additionally, it is capable of syncing 1 gigabyte of data in as little as 8 seconds.

Local Area Network

If devices are connected to the same Wi-Fi access point or are connected via an Ethernet cable, they can utilize the LAN (Local Area Network) for communication.

In certain enterprise or educational networks, Client Isolation Mode may be enabled. When this setting is turned on, devices are unable to discover each other and establish connections. Most "home" network settings have this feature turned off. Different router manufacturers may use different names for this feature, but it typically includes the term "isolation" in its name.

Ditto's discovery protocol relies on UDP multicasting, which needs to be enabled for automatic device discovery. If multicasting is not enabled, manually configure connections between devices. For instructions, see Enabling/Disabling Transports.

There are some limitations regarding LAN sync on iOS devices. To sync with desktop platforms like Windows, you need to request the multicast entitlement from Apple and apply it to your iOS app. However, there are plans to allow iOS devices to sync with all platforms, even without this entitlement.

iOS devices can always sync with other mobile devices such as iOS and Android.

WebSockets

All devices support WebSocket connections, making it the most widely available network transport that requires no special permissions to function. Here are some general characteristics of WebSockets:

  • Internet Connection Requirement: WebSockets require an internet connection for devices to communicate with each other.
  • Lack of Automatic Discovery: Unlike other peer-to-peer transports, WebSockets do not support automatic device discovery. Devices need to specify an IP address and port to establish a connection.
  • LAN Support: Although most use cases involve an internet connection, WebSockets can also function over a LAN.

In summary, WebSockets offer a versatile and easily accessible network transport option for device communication, with the requirement of an internet connection and, if needed, the ability to work over a LAN.

Universal Serial Bus (USB)

If Ditto devices are active and have permissions for USB communication enabled, Ditto can establish a wired connection between the two devices. This allows for direct data sync and communication between the devices using the USB connection.

The Ditto Multiplexer

Ditto automatically handles the complexity of maintaining the previously described transports. In a production environment, these transports work together harmoniously, enabling the data to be divided into chunks and transmitted across various connections.

The system intelligently adjusts for changing network conditions and topology by automatically transitioning between the available transports, optimizing the data transfer process to ensure maximum efficiency.

The following video demonstrates how the Ditto multiplexer dynamically evolves to ensure seamless data exchange:

New and Improved Docs

Ditto has a new documentation site at https://docs.ditto.live. This legacy site is preserved for historical reference, but its content is not guaranteed to be up to date or accurate.