Channel-based WebSocket transport for togo realtime (implements togo.Broker,
overrides the default SSE broker when installed).
togo install togo-framework/realtime-ws
Channels & broadcasting
Clients subscribe over the socket: {"action":"subscribe","channel":"orders"}.
Public channels: any name. Private channels: prefix private- (require a ticket).
Broadcast to a channel by emitting "channel:event" (e.g. app.Emit(ctx, "orders:created", o));
a plain event (no :) goes to everyone.
Tickets (private channels)
GET /events/ticket returns a short-lived HMAC-signed ticket — mount it behind your
auth so only authenticated users get one. The client connects with /events?ticket=...;
a valid ticket unlocks private-* subscriptions. Set REALTIME_SECRET.
Package ws is a channel-based WebSocket transport for togo realtime. It supports
public and private channels, signed connection tickets (so private channels are
authenticated), and channel-scoped broadcasting. It implements togo.Broker and
overrides the default SSE broker when installed.
Publish uses an event of the form "channel:event" to target a channel (private
channels are prefixed "private-"); an event with no ":" broadcasts to everyone.