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 members, 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.
Membership and connection state
The coordinated 3.0.0 candidate adds a read-only authoritative roster:
const currentMembers = await room.members.list();
const stopMembers = room.members.watch((members) => {
for (const member of members) console.log(member.deviceId, member.nodeId, member.userId);
});
Members may be admitted before their application route is ready. Use this
roster for match membership and room.peers for the retained connection
lifecycle projection. Member records contain stable device ID and optional current node ID, user ID
and join time, without endpoint invitations. Sparse non-route members retain
their device identity while their node route is unavailable. Closing the capability retires its
observers, emits an empty roster, and fences pending reads. Unsubscribe when a
consumer stops observing; OpenRTC continues to own membership and recovery.
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);
});
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, capacity, 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.