Appearance
Rust SDK — Getting Started
wish-sdk-rs is the Rust SDK for wish-core, exposed as typed Rust namespaces. Tauri apps build on top of it via wish-app-base, which adds the app framework (document store, sync, debug listener).
This section is the Rust reference for the app surface — what a regular app uses: identity, peers, sending frames. Start here, then see Identity and Peers. For a step-by-step build, the Rust first-app walkthrough goes from cargo new to two instances syncing.
Today the Rust crates are consumed by path from a wish-stack checkout (no crates.io publish yet).
toml
[dependencies]
wish-sdk = { path = "<wish-stack>/wish/core/wish-sdk-rs" }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }The App
App connects to wish-core (~/.wish/core.sock by default) and advertises your protocols. Peer and frame activity arrives on an event channel; RPC calls go through typed namespaces.
rust
use wish_sdk::{App, ConnectOptions};
let mut app = App::connect_with(
"MyApp",
ConnectOptions::default().with_protocols(["myprotocol"]),
)?;
// App::connect(name) connects with no protocols — observer only.
let ids = app.identity().list()?; // see Identity
app.peer().send(&peer, b"hello")?; // see PeersEvents
app.events() is a channel of Event; peer presence and frames arrive here — the only way to learn that a peer came online, went offline, or sent you a frame.
rust
for event in app.events() {
match event {
Event::Online(peer) => println!("{} online", peer.protocol),
Event::Offline(peer) => println!("offline"),
Event::Frame { peer, data } => { /* handle bytes */ }
Event::Disconnected => { /* kernel link dropped */ }
Event::Connected => { /* reconnected — re-subscribe */ }
}
}Event
rust
pub enum Event {
Online(Peer),
Offline(Peer),
Frame { peer: Peer, data: Vec<u8> },
Disconnected, // kernel connection dropped; calls fail until Connected
Connected, // reconnect handshake completed; re-issue subscriptions
}Namespaces
App-surface namespaces, documented in this section:
| Namespace | Covers | Reference |
|---|---|---|
app.identity() | list, get, sign, verify, signers, contacts | Identity |
app.peer() | send, pin / unpin, pins | Peers |
app.signals() | streaming signals | — |
Management tools (Dashboard, the wish CLI) also use admin namespaces — app.connection(), app.nearby(), app.apps(), app.relay(), app.host() — which are not part of the end-user app surface.
For any endpoint without a typed wrapper, call it directly: app.rpc().request(name, args).
Domain types
Returned shapes are typed structs in wish_sdk::domain, serialized to/from CBOR with camelCase field names on the wire (a Rust bytes_in is bytesIn to a JS client). The one most relevant to the app surface:
Peer—{ luid, ruid, rhid, rsid, protocol, online }, app-level. See Peers vs. connections for what a peer is and why it isn't the same as a transport connection.