Client events
Subscribers of private and presence channels can send events straight to the channel's other subscribers, without going through your backend: typing indicators, cursors, reactions.
Enable them
Client events are off by default. Switch them on per app in the dashboard, under Apps & keys. The change applies to connections opened afterwards.
Send and receive
const room = thunderclap.subscribe("private-room-42");
room.trigger("client-typing", { user: "ada" });
room.bind("client-typing", (data, meta) => {
showTyping(data.user, meta.userId); // userId is set on presence channels
});- Names must start with
client-. - The channel must be private or presence, and subscribed.
triggerreturnsfalsewhen the event can't be sent (not subscribed, public channel, invalid name).- The sender doesn't receive its own event.
Rules
| Rule | Value |
|---|---|
| Channels | Private and presence only |
| Rate | 10 events per second per connection |
| Size | Up to 10 KB of data |
| Sequence numbers | None: a missed client event is never reported as a gap |
| Cache channels | Client events are never cached |
Refused events are reported as an error on the channel with code 4306.
Your backend can receive every client event through the client_event webhook.