#websocket-client #native #web #portable

ewebsock

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

9 releases (breaking)

0.8.0 Nov 11, 2024
0.6.0 May 21, 2024
0.5.0 Feb 26, 2024
0.4.0 Oct 7, 2023
0.1.0 Feb 23, 2022

#14 in WebSocket

Download history 2465/week @ 2024-10-26 3092/week @ 2024-11-02 6125/week @ 2024-11-09 4189/week @ 2024-11-16 4788/week @ 2024-11-23 5745/week @ 2024-11-30 6053/week @ 2024-12-07 5963/week @ 2024-12-14 1939/week @ 2024-12-21 2870/week @ 2024-12-28 6169/week @ 2025-01-04 7445/week @ 2025-01-11 5537/week @ 2025-01-18 4330/week @ 2025-01-25 6326/week @ 2025-02-01 3468/week @ 2025-02-08

21,055 downloads per month
Used in 51 crates (4 directly)

MIT/Apache

43KB
667 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 options = ewebsock::Options::default();
// see documentation for more options
let (mut sender, receiver) = ewebsock::connect("ws://example.com", options).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 library with:

# native mode
cargo run -p example_app

# web mode
# install trunk with `cargo install trunk` - https://trunkrs.dev/
(cd example_app && trunk serve)

Dependencies

~0.2–8.5MB
~74K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy