forrealtime

Channels

Scope events to specific groups of subscribers.

Channels let you scope events to a specific group of subscribers — a chat room, a user session, a tenant, etc.

realtime.channel

const room = realtime.channel("room:123");

channel.emit

await room.emit("chat.message", {
  text: "Room message",
  user: "ada",
});

channel.history

Fetch stored messages from the channel's Redis Stream:

const recent = await room.history({ limit: 50 });

Returns an array of { id: string; event: string; data: unknown } entries sorted oldest-first.

On this page