RoomChannel

Constants and framing helpers for Room.channel channel views.

Reserved prefix

Every channel frame begins with CHANNEL_PREFIX (0x63, ASCII 'c' for "channel"), reserved by RoomFramePrefix.Channel — the registry that owns the whole room frame-prefix byte space (#2007). It is distinct from every other claimed byte by construction.

This KDoc previously claimed 0x63 is safe because it sits "outside the CBOR major-type-7 range (0xe0–0xff) used by serialization". That was false. CBOR text-string headers are 0x60 or len, so a bare 3-character CBOR string begins 0x63 — and the same is true of every other prefix in the registry. The real collision band is 0x60..0x7f; see RoomFramePrefix for the full table. Channel views add framing; raw Room sends do not.

Raw Room.broadcast and Room.sendTo refuse payloads of 3 bytes or more starting with 0x63 with ReservedRoomPrefix. A 1- or 2-byte payload starting with 0x63 remains ordinary application data. Channel views supply their header through an internal send path, so any application payload is valid inside it. Room.broadcast documents all reserved families.

Wire format

[0x63][hi byte of subId][lo byte of subId][application payload …]

The 2-byte sub-id is derived from the channel name via channelSubId. Both peers compute the same sub-id independently — no registration handshake is needed. The 3-byte overhead keeps the channel-frame header small.

Properties

Link copied to clipboard

First byte of every channel frame.

Functions

Link copied to clipboard

Derive a 2-byte wire sub-id from a channel name.