fast_websocket_client
A blazing-fast, async-native WebSocket client for Rust, built on top of fastwebsockets
and tokio
.
Supports two modes of operation:
- ๐ High-level callback-based client for ergonomic event-driven use.
- โ๏ธ Low-level direct API for fine-tuned control with minimal dependencies.
Quick Example: examples/async_callback_client.rs
๐ฆ Features
- Async/await support via
tokio
- Built-in reconnection and ping loop
- Optional callback-driven lifecycle management
- Custom HTTP headers for handshake (e.g., Authorization)
๐ Installation
๐ High-Level Callback API
An ergonomic, JavaScript-like API with built-in reconnect, ping, and lifecycle hooks.
// try this example with
// `cargo run --example wss_client`
use ;
use WebSocket;
async
๐งต Low-Level API
use ;
async
๐งช Running the Example
Clone the repo and run:
๐ Migration Guide (from 0.2.0
)
Old | New |
---|---|
client::Offline |
base_client::Offline |
client::Online |
base_client::Online |
Runtime settings via Online 's methods |
Must now be set before connect via ConnectionInitOptions .Changes to the running WebSocket take effect on the next (re)connection. |
New users: We recommend starting with the WebSocket
API for best experience.
๐ Documentation
๐ก Actively maintained โ contributions are welcome!