$ account rerun-io
ewebsock is a Rust WebSocket client library designed to compile and run both natively and on the web via WASM. It provides a simple, uniform API (`connect`, `ws_connect`, `ws_receive`) that abstracts away platform differences: on native it uses `tungstenite` with either a dedicated thread (default) or an opt-in `tokio` backend, while on web it wraps the browser `WebSocket` API via `web-sys`/`wasm-bindgen`. The library handles binary and text messages, ping/pong, connection lifecycle events, and supports TLS (rustls) and custom headers/subprotocols. It is small, well-documented, and heavily feature-flagged to keep dependencies minimal, making it suitable for GUI apps (e.g., egui) that need real-time communication across desktop and browser targets. The codebase is clean and exhibits strong craftsmanship: the separation of backends is clean, error handling is thorough (including read timeouts and graceful shutdown), and the web implementation carefully manages Blob/ArrayBuffer conversion and memory-safe closure lifetimes. The repository also includes an example egui app and an echo server for testing. While it is primarily a library, it is also an application in the sense that it ships executable examples. Overall, it is a mature, well-maintained crate with a clear API and robust platform abstraction.