Rooms API

Activate one ephemeral or durable group avenue

Join

const room = await rtc.rooms.join('match-123', {
  access: 'capability',
  membership: 'ephemeral',
  identity: 'session',
  maxPeers: 8,
  architecture: 'auto',
  payload: 'reliable',
});

rooms.join() returns a Room with peers, channels, diagnostics, architecture(), onArchitectureChanged(), close(), and leave(). It activates exactly one room avenue and does not retain an unused base space or device connection.

Authenticated durable membership

const team = await rtc.rooms.join('team', {
  access: 'authenticated',
  membership: 'durable',
  auth,
});

Durable membership is an advanced capability that must be enabled in the developer portal. It creates durable control-plane work and therefore costs more than ephemeral membership.

Capacity

maxPeers may lower the client limit. It cannot increase admission. The server derives the actual ceiling from the manifest, remaining budget, current fan-out, per-principal limits, and the platform technical maximum. This release admits at most 50 members to a room or space.

Adaptive architecture

const room = await rtc.rooms.join('show-123', {
  access: 'authenticated',
  auth,
  architecture: 'auto',
  payload: 'reliable',
});

await room.channel('announcements').send({ live: true });

The API stays the same. OpenRTC keeps groups of eight or fewer full mesh and uses a bounded room-wide overlay for eligible larger groups. Broadcast authorship, membership generation, lifetime, hop, replay, and forwarding limits are checked by the shared Rust core in native and browser runtimes. Displaced active routes overlap a changed topology until the Rust owner has proved every current active route connected and admitted. A steady topology does not dial speculative backups.

channel.sendTo(peerId, value) is never sent through the sparse broadcast overlay. It requires an already available direct authorized route; automatic route-on-demand is not shipped yet.

const snapshot = room.architecture();
const stop = room.onArchitectureChanged((next) => {
  console.log(next.effective, next.phase, next.reason);
});

const quote = rtc.usage.estimateRoom({
  architecture: 'auto',
  maxMembers: 50,
  durationSeconds: 3600,
  delivery: 'latest-state',
  maxPayloadBytes: 512,
  maxMessagesPerSecond: 20,
});

payload defaults to reliable. Use payload: 'latest-state' only when old updates may be replaced by newer revisions. Fixed mesh is limited to 16 members. Fixed sparse is limited to 50 members and requires latest-state delivery. managed is unavailable in 2.5 and fails with the non-retryable room-architecture-unavailable code. authority requires explicit app and rollout enablement. advancedFanout: true is deprecated and maps to fixed sparse with latest-state delivery for this compatibility release.

See Adaptive large rooms for selection, transition, quote, and native Rust details.

Leave

await room.leave();

Leaving retires the active avenue. For durable rooms it also removes the durable membership; closing an ephemeral handle only retires live membership.