liminal_sdk/remote/websocket/web_socket.rs
1//! Browser (wasm) WebSocket adapter for the transport-neutral driver
2//! (LP-WS-TRANSPORT R3.2, folded F4/F5).
3//!
4//! Two layers:
5//!
6//! - [`mirror`] — the platform-neutral conversion layer (F5): pure functions
7//! mapping browser socket facts onto the driver's closed [`SocketEvent`]
8//! set and driver commands onto closed browser actions. No platform type
9//! appears, so it compiles natively and is pinned by the deterministic
10//! `ws_browser_mirror_trace` suite without a browser.
11//! - [`adapter`] — the `web-sys` shim (wasm32 with the `browser` feature):
12//! owns the JavaScript socket, pins `binaryType = "arraybuffer"` at
13//! construction (F4), feeds each callback once into the shared driver, and
14//! executes emitted commands. Event-driven only: no timer, interval,
15//! executor, or `bufferedAmount` polling.
16//!
17//! All protocol, framing, correlation, and fate logic stays in
18//! [`core`](super::core); both layers are mirrors, not implementors.
19//!
20//! [`SocketEvent`]: super::core::SocketEvent
21
22pub mod mirror;
23
24#[cfg(all(target_arch = "wasm32", feature = "browser"))]
25pub mod adapter;
26
27pub use mirror::{
28 BrowserCommandRefusal, BrowserMessageData, BrowserSocketAction, action_for_command,
29 close_event, error_event, message_event, open_event,
30};
31
32#[cfg(all(target_arch = "wasm32", feature = "browser"))]
33pub use adapter::{
34 AdapterFault, AdapterSignal, AdapterSignalSink, BrowserSocketError, WebSysWebSocketSocket,
35};