capnweb-server
Production-ready server for Cap'n Web RPC protocol with capability management.
Overview
capnweb-server provides a high-performance, production-ready server implementation of the Cap'n Web RPC protocol. It supports multiple transport layers and includes built-in capability management, rate limiting, and observability.
Features
- Multiple transports: HTTP batch, WebSocket, and WebTransport support
- Capability management: Register and manage RPC capabilities
- Rate limiting: Built-in rate limiting and DOS protection
- Session management: Automatic session tracking and cleanup
- Observability: Structured logging and metrics
- Type-safe handlers: Async trait-based RPC target implementation
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
Create a simple server:
use ;
use ;
use async_trait;
use ;
use Arc;
use Result;
;
async
Binary
The crate includes a capnweb-server binary for quick testing:
Configuration
The server can be configured via ServerConfig:
port: Server port (default: 8080)host: Bind address (default: "127.0.0.1")max_batch_size: Maximum batch request sizerate_limit: Requests per second limitsession_timeout: Session inactivity timeout
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.