6 releases (breaking)

0.5.0 Feb 26, 2024
0.4.1 Feb 15, 2024
0.4.0 Oct 7, 2023
0.3.0 Sep 30, 2023
0.1.0 Feb 23, 2022

#22 in WebSocket

Download history 602/week @ 2023-12-22 568/week @ 2023-12-29 1903/week @ 2024-01-05 1200/week @ 2024-01-12 1364/week @ 2024-01-19 1441/week @ 2024-01-26 1813/week @ 2024-02-02 1854/week @ 2024-02-09 1246/week @ 2024-02-16 1930/week @ 2024-02-23 1861/week @ 2024-03-01 1646/week @ 2024-03-08 2181/week @ 2024-03-15 1454/week @ 2024-03-22 1656/week @ 2024-03-29 2225/week @ 2024-04-05

7,970 downloads per month
Used in 22 crates (2 directly)

MIT/Apache

33KB
553 lines

ewebsock

github Latest version Documentation unsafe forbidden Build Status MIT Apache

This is a simple WebSocket library for Rust which can be compiled to both native and web (WASM).

Usage

let (mut sender, receiver) = ewebsock::connect("ws://example.com").unwrap();
sender.send(ewebsock::WsMessage::Text("Hello!".into()));
while let Some(event) = receiver.try_recv() {
    println!("Received {:?}", event);
}

Testing

First start the example echo server with:

cargo r -p echo_server

Then test the native library with:

cargo run -p example_app

And the web library with:

./example_app/start_server.sh &
./example_app/build_web.sh --open

Dependencies

~7–10MB
~200K SLoC