Expand description
WebAssembly support for AeroSocket
This crate provides a complete WebSocketClient for browser / WASM environments.
It wraps the native web_sys::WebSocket API and exposes a clean Rust interface that
is also optionally exported to JavaScript via wasm-bindgen.
§Example
ⓘ
use aerosocket_wasm::{WebSocketClient, WebSocketConfig};
use wasm_bindgen_futures::spawn_local;
spawn_local(async {
let cfg = WebSocketConfig::new().with_protocol("chat".to_string());
let mut client = WebSocketClient::new("wss://example.com/ws".to_string(), cfg);
client.connect().await.expect("connect failed");
client.send_text("hello").expect("send failed");
});Modules§
- prelude
- Re-exports for convenient glob imports.
Structs§
- WebSocket
Client - A WebSocket client for browser / WASM environments.
- WebSocket
Config - Configuration for a
WebSocketClient.