host

abstract suspend fun host(pattern: Pattern, memberName: String? = null, roomId: RoomId? = null, admission: HostAdmission): Room

Host a new room. The caller's peer becomes the SessionRole.Host.

memberName is this peer's own roster name — the label other members see for it. It defaults to null, in which case the peer's own id (Room.selfId) is used. It is deliberately not derived from Pattern.sessionName: the session name names the session, not this member (#1177).

roomId is this room's identity (Room.roomId). It defaults to null, in which case the factory mints a fresh one — a new room every time, which is what makes Room.roomId a per-session key rather than a per-device one (#1594).

Supply it when the identity is decided outside kuilt and the room must adopt it rather than invent its own: a lobby code or invite link the players already hold, a game id a matchmaking service assigned, or an id a durable record was keyed on before the room could be woven. Every member then reads that exact value off Room.roomId.

It does not make a host restart resumable — see Room.roomId: a restarted host holds no seats, and reusing an id does not give it any.

admission decides who comes in: the room asks its HostAdmission.policy about every newcomer whose proven key holds no seat to restore, and reads HostAdmission.revocations so that a device revoked since its seat was admitted does not get that seat back. A device whose seat is gone and that presents a good pass is let back in without the policy; the pass is checked against the room's own device key and those revocations (#3222). It is required, and last, so a host is never opened without one and a forwarding factory that drops it does not compile. HostAdmission(AdmissionPolicy.open(), RevocationList.inMemory()) admits everyone.