PubSub
Processes
Push a channel down value from outside a connected socket.
Use this from an HTTP handler, job, or [Platform.worker] when something happened on the server and every subscriber on `topic` should hear about it. Inside a channel's own `update`, prefer `Channel.broadcast` / `Channel.broadcastFrom` so the push stays in that channel's effect API.
-- after inserting a message in a request handler:
( model
, PubSub.broadcast chatChannel roomId
(MessageAdded { body = body, at = now })
)Channel is the typed websocket contract (topics, up/down/reply). Socket.supervised mounts the path. See [Channel] and the chat example under `examples/05_chat`.
Values
broadcast
broadcast : Channel topic up down reply state msg -> topic -> down -> Cmd msgBroadcast down to every subscriber of topic on this channel. Returns Cmd.none-shaped so you can put it in a TEA command batch.
Examples
PubSub.broadcast chatChannel topic payload