sercrod

WebSocket

What you will find: normative behavior for *websocket and *websocket.send, including connection lifecycle, exposed state, events, and host helper APIs. No tutorials are included.

Scope

This page defines:


*websocket="urlOrConfigExpr"

Host data fields

While active, the host maintains the following reactive fields:

These fields are updated by the directive in response to socket events and are part of the normal update cycle.

Events

The host dispatches the following CustomEvents:

Event names and timings are stable. Payload shapes may include additional implementation-defined fields.

Parsing of incoming messages

Re-connection policy


*websocket.send="urlExpr" With *keys

If no socket is currently open, the send is a no-op or results in a warning depending on configuration.

Old spelling:


Host helper API

When *websocket is present, the host exposes a helper under the element for direct control:

Helper presence and exact shapes are stable at the names above. Additional helper fields may exist.


Parameter changes and multiple hosts


Error handling


Cleanup and lifecycle


Next page: world.md