wasm-bindgen is a Rust library and CLI toolchain that facilitates high-level interoperability between Rust-generated WebAssembly modules and JavaScript. It provides a `#[wasm_bindgen]` procedural macro to import JS functions and export Rust functions/structs/enums to JS, along with a post-processing CLI (`wasm-bindgen`) that generates JavaScript and TypeScript glue code for multiple targets (bundler, web, Node.js, Deno, no-modules). The repository also includes runtime crates (`js-sys`, `web-sys`, `wasm-bindgen-futures`, `wasm-bindgen-test`) that offer comprehensive bindings to standard JavaScript APIs and browser Web APIs, generated from WebIDL definitions. The project is the de facto standard for Rust-to-Wasm development, with extensive examples, benchmarks, and a robust test suite covering browser, Node, Deno, and headless environments.
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.