Introduction
This library provides type-safe WebSocket communication with a request-response and notification system built on top of a flexible protocol.
It ensures compile-time guarantees for message structure, reduces runtime errors, and simplifies building Rust client/server applications.
- Dynamic Methods: Each message includes a method enum for type safety.
- Typed Requests & Responses: Automatic serialization and deserialization.
- Optional Notifications: Send asynchronous notifications across sessions.
Features
- Fully typed WebSocket sessions
- Type-safe request/response mechanism
- Optional typed notifications (Todo)
- Lightweight, minimal runtime overhead
- Async-first with Tokio support
Installation
Basic Example (client)
;
let session = connect.await?;
session.start_receiver;
session
.
.await?;
Basic Example (server)
;
let server = bind.await?;
server
.session_loop.await;
Protocol
Request
The request id is separated from the peer, and will increment only on it's requests.
Response
The response id must remain the same as the request.
Notifications
A notification is a method that doesn't need validation or output, it simply notifies a peer for a specific information