Skip to content

v0.49.0 — broadcasting

Choose a tag to compare

@tshafer tshafer released this 11 Jul 16:11
· 109 commits to main since this release

Push events to clients in real time over named channels, on a pluggable Broadcaster — the core owns no socket, so point it at Pusher/Ably (fetch), a Cloudflare Durable Object, or the built-in MemoryBroadcaster (in-process fan-out, for tests).

  • broadcast(channels, event, payload) publishes to one or more channels.
  • channelAuth("orders.{id}", (user, params) => …) gates private and presence channels — return false (deny), true (allow), or member data (presence) — resolved by authorizeChannel at your socket-auth endpoint. Composes with auth() and the authorization layer.
  • MemoryBroadcaster.subscribe() fans out in-process (inside a Durable Object that owns the WebSockets, or an SSE loop).

318 tests; type-checked doc examples. See docs/broadcasting.md.