actions/register_ws_endpoint.ts

Composed WebSocket endpoint registration — the idiomatic consumer entry point for mounting a fuz_app WS endpoint.

Wraps the standard upgrade stack every consumer writes by hand:

1. verify_request_source(allowed_origins) — reject disallowed origins before the upgrade handshake runs. 2. require_auth — reject unauthenticated upgrades. 3. Authorization phase — resolve the acting actor against the authenticated account plus an optional ?acting=<uuid> query string, and build the RequestContext that per-message dispatch reads. Multi-actor accounts must supply ?acting to pick a persona; single-actor accounts work without it. 4. Optional require_role(required_role) — for endpoints gated to a specific role.

Then delegates to register_action_ws for per-message JSON-RPC dispatch.

Declarations
#

2 declarations

view source

register_ws_endpoint
#

RegisterWsEndpointOptions
#

actions/register_ws_endpoint.ts view source

RegisterWsEndpointOptions

inheritance

allowed_origins

Origin allowlist regexes — typically parsed from the ALLOWED_ORIGINS env var via parse_allowed_origins. Passed straight to verify_request_source.

type Array<RegExp>

required_role

Role required to upgrade. Omit for any authenticated account (require_auth + actor resolution alone); set to e.g. ROLE_ADMIN to gate the endpoint behind a role. The per-action auth in each spec still applies at dispatch time — this is a coarse upgrade-time gate.

Depends on
#