Skip to main content

Module ws

Module ws 

Source
Expand description

WebSocket boundary: upgrade, per-socket read/write pumps, event dispatch.

This is the only module that touches axum::extract::ws — the analogue of crate::web::boundary for the real-time layer. Everything above it speaks arcly types (WsClient, WsMessage, GatewayRuntime).

§Per-connection model (no hot-path locks)

           ┌─────────────────── handle_socket task ───────────────────┐
 socket ──>│ reader: stream.next() ─> dispatch(event) ─> handler fut  │
           │ writer: rx.recv()     ─> sink.send(frame)                │
           └───────────────────────────────────────────────────────────┘

The reader and writer run as independent halves of the split socket. Inbound frames are parsed and routed through the gateway’s dispatch table (an immutable &HashMap — lock-free read). Outbound frames are produced by any task via the registry’s sharded channels and drained by this socket’s writer.

Structs§

WsTuning
Per-gateway runtime tuning, sourced from LaunchConfig at mount time.

Functions§

ws_route
Build the axum MethodRouter that upgrades HTTP→WebSocket for one gateway.