Linux & Raspberry Pi
Ditto supports recent versions of Raspberry Pi and some other Linux-based systems
These instructions are required to run Ditto on Linux regardless of the programming language. This applies to all SDKs, including JavaScript (Node/Electron), C#, C++, etc.
Compatibility
System | Support | Notes |
---|---|---|
Linux x86 64-bit | Full support | |
Raspberry Pi 4B 32-bit | Full support | Bullseye |
Raspberry Pi 3 32-bit | Full support | Bullseye |
Linux ARM 64-bit | Coming soon |
Linux SDK Language | Support |
---|---|
Node.js | Full support |
Rust | Full support |
C++ | Coming soon |
Python | Coming soon |
Network Transport | Linux Support |
---|---|
Bluetooth Low Energy | Full support |
LAN / WLAN | Full support |
Websockets (Big Peer) | Full support |
Apple AWDL | No (iOS/Mac only) |
Wifi Aware | No (Android only) |
Wifi Direct | No |
System preparation for happy Ditto operation
Bluetooth Low Energy - BlueZ
If you would like to run Ditto on a Linux device and leverage Bluetooth Low Energy please follow the instructions.
Your device will need to install or update BlueZ with version 5.66 or higher. We've outlined a quick snippet set of instructions below to install BlueZ 5.66 as an example:
sudo apt-get updatesudo apt-get upgradesudo apt-get install libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev docutils-common -ywget http://www.kernel.org/pub/linux/bluetooth/bluez-5.66.tar.xztar -xf bluez-5.66.tar.xzcd bluez-5.66./configuremakesudo make install
Add support for Linux to iOS connections.
BlueZ 5.51 and above try to automatically read the battery status/service of devices when they connect. However, by default, iOS devices will prevent BlueZ services from reading the battery service. As a result, BlueZ connection attempts will cause iOS devices to show a pairing prompt constantly. Therefore, we will need to disable the battery service in BlueZ, using the following steps.
With your favorite editor, open the bluetooth service file. On Raspberry Pi OS it's located:
/usr/lib/systemd/system/bluetooth.service
, on other versions it may be here:/etc/systemd/system/bluetooth.target.wants/bluetooth.service
.
You will probably need to use su permission to write to this file.Find the line beginning with
ExecStart=
and add-P battery
to the end. Now the line should look like this:
ExecStart=/usr/lib/bluetooth/bluetoothd -P battery
- Save the file.
- Run
sudo systemctl daemon-reload
andsudo systemctl restart bluetooth
to apply the changes to the Bluetooth service - Linux’s bluetooth system aggressively prefers classic bluetooth (BR/EDR) mode when it encounters a Mac - this results in both the pairing popups and intermittent sync. You can prevent this with a little Bluetooth configuration on your Linux machines before running your app.
sudo hciconfig hci0 downsudo btmgmt bredr offsudo hciconfig hci0 up
After that, BlueZ should be able to connect to iOS devices without prompting and Ditto Apps should be able to communicate over BT-LE between iOS and Linux.
Run the following command to set BlueZ' support for multiple advertisements.
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
Your Linux system is now ready to install and run Ditto.
See here for Node.js SDK.
See here for Rust SDK.
The Python and C++ SDKs are in development. If you would like early access, please contact us
Linux demo application (Node.js)
Demo Ditto syncing from your Raspberry Pi to your iOS or Android device, over Bluetooth LE or WLAN using our Tasks App:
1) Make sure you've gone though the steps to prepare your system (see above). 2) Install Node Version Manager on your Pi.
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
Now restart your terminal session so the changes can be picked up.
3) Install the LTS version of Node.js (v18.13) on your Pi.
nvm install 18.13
4) Clone the samples app repo to your machine.
git clone https://github.com/getditto/samples.gitcd samples/tasks/nodejs/
Edit the index.ts file to include your own test App ID and Token from https://portal.ditto.live
5) Run the demo app!.
npm installnpm run buildnode index.js
You should see this in your Pi's console:
************* Commands *************--insert my new task Inserts a task Example: "--insert Get Milk"--toggle myTaskTd Toggles the isComplete property to the opposite value Example: "--toggle 1234abc"--delete myTaskTd Deletes a task Example: "--delete 1234abc"--list List the current tasks--exit Exits the program************* Commands *************Your command:
6) Create a new task and then check to see it being updated in our handy data browser.
You'll need to log in and view the test app ID you created earlier.
7) Now build and run the Tasks app for iOS or Android.
Be sure to reuse the same App ID and Token as you used on your Pi.
iOS / Android examples are here.