#native #websocket-client #portable #web

ewebsock

WebSocket client that works natively and on the web (WASM)

7 releases (breaking)

0.6.0 May 21, 2024
0.5.0 Feb 26, 2024
0.4.1 Feb 15, 2024
0.4.0 Oct 7, 2023
0.1.0 Feb 23, 2022

#15 in WebSocket

Download history 1472/week @ 2024-03-27 1797/week @ 2024-04-03 3553/week @ 2024-04-10 3319/week @ 2024-04-17 3718/week @ 2024-04-24 2685/week @ 2024-05-01 2722/week @ 2024-05-08 3892/week @ 2024-05-15 2953/week @ 2024-05-22 3244/week @ 2024-05-29 2463/week @ 2024-06-05 3148/week @ 2024-06-12 2680/week @ 2024-06-19 3095/week @ 2024-06-26 3729/week @ 2024-07-03 3009/week @ 2024-07-10

12,887 downloads per month
Used in 27 crates (3 directly)

MIT/Apache

40KB
607 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