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:
For secure WebSocket connections (wss://), enable a TLS backend:
Example:
use connect_async;
let = connect_async.await?;
// Send and receive messages
ws_stream.send.await?;
let msg = ws_stream.next.await.unwrap?;