| Crates.io | loro-websocket-client |
| lib.rs | loro-websocket-client |
| version | 0.1.0 |
| created_at | 2025-11-30 15:26:42.741893+00 |
| updated_at | 2025-11-30 15:26:42.741893+00 |
| description | Async WebSocket client for the Loro protocol |
| homepage | |
| repository | https://github.com/loro-dev/protocol |
| max_upload_size | |
| id | 1958367 |
| size | 108,412 |
Async WebSocket client for the Loro protocol. Exposes:
Client to send/receive raw loro_protocol::ProtocolMessage.LoroWebsocketClient that joins rooms and mirrors updates into a loro::LoroDoc, matching the TypeScript client behavior.%ELO support is WIP: the Rust adaptor currently ships snapshot-only packaging for encrypted docs and APIs may change.
use std::sync::Arc;
use loro::{LoroDoc};
use loro_websocket_client::LoroWebsocketClient;
# #[tokio::main(flavor = "current_thread")]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = LoroWebsocketClient::connect("ws://127.0.0.1:9000/ws1?token=secret").await?;
let doc = Arc::new(tokio::sync::Mutex::new(LoroDoc::new()));
let _room = client.join_loro("room1", doc.clone()).await?;
// mutate doc then commit; the client auto-sends updates
{ let mut d = doc.lock().await; d.get_text("text").insert(0, "hello")?; d.commit(); }
# Ok(()) }
"ping"/"pong") and filters control frames.cargo test -p loro-websocket-client