Loading...
Loading...
Open a connection to the project's WebSocket endpoint. Resolves the ws(s):// scheme from the current origin; forwards protocols (e.g. for subprotocol-based auth). Same-origin cookies are sent automatically on the handshake.
Connects to the app's `#[ws]` handler at `/__ossido/ws` (resolving `ws(s)://` from the current origin) and returns a small typed handle. `on(handler)` subscribes to inbound server events and returns an unsubscribe; `send(event)` sends a client event; `close()` closes; and `raw` exposes the underlying `WebSocket`. Send and receive are typed against the events you declared.