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

#19 in WebSocket

Download history 1559/week @ 2024-01-25 1662/week @ 2024-02-01 1870/week @ 2024-02-08 1440/week @ 2024-02-15 1686/week @ 2024-02-22 1969/week @ 2024-02-29 1498/week @ 2024-03-07 2082/week @ 2024-03-14 1782/week @ 2024-03-21 1497/week @ 2024-03-28 1754/week @ 2024-04-04 4043/week @ 2024-04-11 3082/week @ 2024-04-18 3495/week @ 2024-04-25 2875/week @ 2024-05-02 2213/week @ 2024-05-09

12,386 downloads per month
Used in 20 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–11MB
~201K SLoC