4 releases (2 breaking)
Uses new Rust 2024
| 0.3.0 | Jan 29, 2026 |
|---|---|
| 0.2.0 | Dec 1, 2025 |
| 0.1.1 | Nov 18, 2025 |
| 0.1.0 | Nov 16, 2025 |
#2364 in Asynchronous
11,593 downloads per month
Used in 14 crates
(2 directly)
415KB
8K
SLoC
compio-ws
WebSocket library for compio.
This crate provides WebSocket client and server support for compio applications, built on top of the tungstenite WebSocket library. It enables real-time bidirectional communication over TCP connections with optional TLS support.
Features
- WebSocket client and server support
- Built on tungstenite
- TLS/SSL support with multiple backends:
native-tls: Platform-specific TLSrustls: Pure Rust TLS implementation
- Certificate verification options (platform-verifier, native-certs, webpki-roots)
Usage
Use compio directly with ws feature enabled:
cargo add compio --features ws
For secure WebSocket connections (wss://), enable a TLS backend:
cargo add compio --features ws,rustls # or native-tls
Example:
use compio::ws::connect_async;
let (mut ws_stream, _) = connect_async("wss://example.com/socket").await?;
// Send and receive messages
ws_stream.send(Message::text("Hello WebSocket!")).await?;
let msg = ws_stream.next().await.unwrap()?;
Dependencies
~7–25MB
~281K SLoC