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

Download history 500/week @ 2025-11-13 1085/week @ 2025-11-20 1586/week @ 2025-11-27 1873/week @ 2025-12-04 2220/week @ 2025-12-11 2482/week @ 2025-12-18 2600/week @ 2025-12-25 1414/week @ 2026-01-01 2528/week @ 2026-01-08 1609/week @ 2026-01-15 1665/week @ 2026-01-22 2864/week @ 2026-01-29 2307/week @ 2026-02-05 2432/week @ 2026-02-12 2081/week @ 2026-02-19 3937/week @ 2026-02-26

11,593 downloads per month
Used in 14 crates (2 directly)

MIT license

415KB
8K SLoC


compio-ws

MIT licensed crates.io docs.rs Check Test

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 TLS
    • rustls: 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