Skip to main content

Goal

Push real-time updates (chat messages, notifications, live dashboards) to connected clients over WebSocket.

Steps

1. Enable the Stream worker

iii-config.yaml

2. Write to a stream

stream-writer.ts

3. Read from a stream

stream-reader.ts

4. Connect a client

Clients connect to the stream WebSocket endpoint to receive live updates:
client.js

5. React to stream events

Register triggers to run server-side logic when clients join or when stream data changes.

On client join

stream-triggers.ts

On message created

stream-triggers.ts

Result

Any data written to the stream via stream::set is immediately pushed to all connected WebSocket clients subscribed to that stream and group. Server-side triggers let you react to joins, leaves, and data changes without polling.
For all stream operations, trigger payload shapes, and authentication, see the Stream worker reference.