Arora WebSocket Protocol
The open local bridge for Arora: a WebSocket server implementing
[arora_bridge::Bridge] (see [bridge::WsBridge]), with type-safe message
definitions, a method registry, and a ready-to-use server.
Features
- Message Types: Type-safe [
Incoming] and [Outgoing] message enums
- Registry: Store slots and methods with [
Registry]
- Server: Full WebSocket server with [
AroraWSServer] (requires server feature)
- Connection Trait: Implements [
AroraConnection] for protocol-agnostic usage
Protocol Overview
Messages are JSON-encoded with a type field discriminator:
{"type": "set_slot_values", "values": {"face/mouth": {"f64": 0.5}}}
{"type": "list_slots", "path": "face"}
{"type": "list_methods"}
{"type": "invoke", "method": "reset", "request_id": "req-1"}
{"type": "set_slot_values_resp", "success": true}
{"type": "list_slots_resp", "slots": [...]}
{"type": "list_methods_resp", "methods": [...]}
{"type": "invoke_resp", "success": true, "request_id": "req-1"}
Server Example
use arora_websocket::{AroraWSServer, ServerConfig, MethodInfo, InvokeResult};
use tokio_util::sync::CancellationToken;
#[tokio::main]
async fn main() {
let server = AroraWSServer::with_port(9000);
server.registry().register_method_fn(
MethodInfo {
path: "reset".to_string(),
params: vec![],
return_type: None,
description: Some("Reset to defaults".to_string()),
},
|_args| InvokeResult::ok(),
).await;
server.set_set_slot_values_handler(|values| {
println!("Received {} updates", values.len());
Ok(())
}).await;
let cancel = CancellationToken::new();
server.run(cancel).await.unwrap();
}