#websocket #websockets #portable #native #web

ewebsock

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

2 unstable releases

0.2.0 Apr 8, 2022
0.1.0 Feb 23, 2022

#113 in WebSocket

Download history 673/week @ 2023-02-05 1087/week @ 2023-02-12 338/week @ 2023-02-19 696/week @ 2023-02-26 401/week @ 2023-03-05 396/week @ 2023-03-12 818/week @ 2023-03-19 531/week @ 2023-03-26 459/week @ 2023-04-02 612/week @ 2023-04-09 1870/week @ 2023-04-16 1018/week @ 2023-04-23 1003/week @ 2023-04-30 1144/week @ 2023-05-07 934/week @ 2023-05-14 774/week @ 2023-05-21

3,923 downloads per month
Used in 4 crates (via re_ws_comms)

MIT/Apache

20KB
384 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

Locally:

cargo run -p example_app

Web:

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

Dependencies

~7–15MB
~282K SLoC