Desktop api
Desktop Scatterbrain applications are built using the same serialization protocol that Scatterbrain peers use to communicate with each other, paired with mdns based service discovery. There is a library that automates this at scatterbrain-rs. While currently only rust based applications are supported, as the api stabilizes a C ABI interface will be added to support more languages and platforms.
To make rapidly prototyping responsive applications easier, there is also a flutter plugin here. This uses the same rust codebase with a dynamically generated wrapper interface so it will always be up-to-date.
An example application using the flutter codebase is Subrosa Desktop, and an example application using the pure rust codebase is sbcli
Desktop api stability
The desktop api has not reached full maturity, so caution must be used due to frequent api changes. One major change slated for release soon is the migration to websockets for the underlying api transport.
Adding the desktop api to your rust projects
# for pure rust projects, not for flutter
Adding the desktop api to flutter projects
First setup the project directory
# for flutter projects
Then edit pubspec.yaml
to include
dependencies:
scatterbrain_flutter:
path: ./scatterbrain
Example rust api usage
Scan for devices
let mut scanner = new;
scanner
.mdns_scan
.await?;
Attempt to pair with a device
let host = from_str.unwrap;
let host: HostRecord = host.into;
let stream = host.connect.await?;
let config = default;
let session = stream
.pair
.await?;
Send a message
let host = from_str.unwrap;
let host: HostRecord = host.into;
let stream = host.connect.await?;
let message = from_vec;
stream.send_messages.await?;
Full API docs
The full desktop api documentation can be accessed from here