Learn · Room model

Channels

Organize facts into named topics with explicit types and per-topic access.

A channel is a named topic inside a room. Use chat for messages, vision for structured observations, and results for application outcomes. A channel organizes facts and permissions; it does not allocate a socket or a separate event log.

Name the topic and its kind

TypeScript
// Trusted provisioning code; owner is a RoomClient.
await owner.createChannel({
  id: "chat",
  type: "text",
  direction: "bidirectional",
});

// Client code: a local handle for the provisioned topic.
const chat = room.channel("chat");
await chat.publish("text.message.committed", {text: "Hello, room."});

room is the scoped client's RoomClient. Calling channel() makes no request and does not create or validate a channel. Provision the definition explicitly so snapshots and channel-type selectors can describe it.

Identifier Meaning Example
Channel ID One topic in this room; used for channel event grants chat
Channel type Classification shared by similar topics text
Event type The fact and payload contract text.message.committed

The direction value describes intended input/output use. For ordinary events, it does not replace event:publish or event:subscribe grants.

Choose channels around meaningful access and selection

Separate topics when clients need different permissions or independently selected data. A specialist-only topic may deserve its own channel grants. Different message kinds can often remain in chat and use distinct event types.

All topics in a room still share its increasing sequence. A consumer of chat should expect gaps where other topics committed events. Those gaps are handled by cursors and checkpoints.

Give native media an explicit binding

A camera track and an observation about its contents are different data. A media input describes the native track; an observation channel holds structured events produced from it. The media guide shows how to create each.

For the ordinary event path, continue with publishers and selectors. Definitions live in types.go, SDK client.ts, and selector.go.

Search the documentation

Type to search all guides.

Diagram

100%Open original ↗