Skip to main content

run_dispatch

Function run_dispatch 

Source
pub async fn run_dispatch<R>(
    read: R,
    write: WsSink,
    peer: String,
    state: Arc<ServerState>,
) -> Result<(), Box<dyn Error>>
where R: Stream<Item = Result<Message, Error>> + Unpin + Send,
Expand description

Transport-neutral entry point: drives the JSON-RPC dispatch loop against an already-handshake-completed split WebSocket. Generic over the read half (any Stream<Item = Result<Message, WsError>>) and the write half (a [WsSink] — type-erased so this function doesn’t templatize every downstream consumer of WsChannel).

peer is a free-form string (“127.0.0.1:1234” for TCP, “uds:/path/sock” for UDS, “axum:…” for embedders) — used only for tracing fields, never for dispatch logic.