Skip to main content

socket

Function socket 

Source
pub async fn socket(
    __arg0: Path<String>,
    ws: WebSocketUpgrade,
) -> Response<Body>
Expand description

GET /__larust_push/{channel} - upgrades to a WebSocket and streams every [broadcast] call’s HTML straight through, verbatim, for the lifetime of the connection. Pure server → client push in v1: no client → server message is ever acted on (an inbound message is only read at all to detect the browser tab closing the connection).

Deliberately outside any CSRF check (unlike @wire(...)’s update route) - CSRF protects against an attacker-initiated state change riding the victim’s cookies, and this endpoint never processes a client-originated state change at all, only pushes data out. If a channel carries anything sensitive, gate it the same way any other route would be gated - this handler is registered explicitly by the app (matching @wire(...)’s own routes), so ordinary middleware composition already covers it; no per-channel authorization exists at the framework level in v1.