capnweb-client
High-performance Rust client for Cap'n Web RPC protocol with batching and pipelining.
Overview
capnweb-client provides a feature-rich client implementation for the Cap'n Web RPC protocol. It supports automatic batching, promise pipelining, capability management, and multiple transport options.
Features
- Automatic batching: Efficiently batch multiple RPC calls
- Promise pipelining: Chain operations without waiting for intermediate results
- Multiple transports: HTTP, WebSocket, and WebTransport support
- Connection pooling: Reuse connections for better performance
- Retry logic: Automatic retry with exponential backoff
- Type-safe API: Strongly-typed client interface
Usage
Add to your Cargo.toml:
[]
= "0.1.0"
Basic client usage:
use ;
use json;
use Result;
async
Advanced Features
Promise Pipelining
// Chain operations on promises
let promise = client.call;
let email_promise = promise.pipeline;
let email = email_promise.await?;
Connection Management
// Use WebSocket for real-time communication
let ws_client = websocket.await?;
// Subscribe to events
ws_client.subscribe.await?;
Configuration Options
url: Server endpoint URLbatch_size: Maximum batch sizebatch_timeout_ms: Batch window timeoutconnection_timeout_ms: Connection timeoutretry_count: Number of retries on failureretry_delay_ms: Initial retry delay
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.