AdmitMessage

@Serializable
sealed interface AdmitMessage

Wire messages that implement the admit/identify handshake.

Framing: each AdmitMessage is CBOR-encoded and sent as a us.tractat.kuilt.core.Swatch payload. The receiver detects admit frames by a discriminator prefix tag (PREFIX_BYTE) that application frames must not start with — this avoids a separate channel or wrapper envelope.

Handshake flow:

Joiner → Host : Hello(identity)
Host → Joiner : Welcome(assignedId, identity)
Host → all others : Welcome(assignedId, identity) [roster broadcast]

If the host rejects the joiner (e.g. already admitted with same dedupKey):

Host → Joiner : Reject(reason)

The host-side runs this passively for incoming Hellos. The joiner sends Hello immediately upon transport connection and waits for Welcome or Reject.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@Serializable
@SerialName(value = "farewell")
data class Farewell(val peerId: String, val expired: Boolean = false) : AdmitMessage

Sent by the host to every remaining member when a member departs cleanly (the host received that member's Goodbye).

Link copied to clipboard
@Serializable
@SerialName(value = "goodbye")
data object Goodbye : AdmitMessage

Sent by a joiner to the host on a deliberate us.tractat.kuilt.session.Room.leave.

Link copied to clipboard
@Serializable
@SerialName(value = "hello")
data class Hello(val displayName: String, val sessionId: String, val deviceId: String? = null, val targetRoom: String? = null, val protocolVersion: Int? = null) : AdmitMessage

Sent by a joiner to the host immediately after transport connection.

Link copied to clipboard
@Serializable
@SerialName(value = "paused")
data class Paused(val peerId: String, val expiresAt: Long) : AdmitMessage

Sent by the host to every other member when a member's link drops and its seat is being held open — the presence counterpart of Farewell's eviction (#1557).

Link copied to clipboard
@Serializable
@SerialName(value = "reject")
data class Reject(val reason: String, val codeId: String? = null) : AdmitMessage

Sent by the host to reject a joiner's Hello or Resume.

Link copied to clipboard
@Serializable
@SerialName(value = "resume")
data class Resume(val tokenPeerId: String, val tokenRoomId: String, val issuedAt: Long) : AdmitMessage

Sent by a joiner to the host to resume a partitioned session.

Link copied to clipboard
@Serializable
@SerialName(value = "resume-ack")
data object ResumeAck : AdmitMessage

Sent by the host to confirm that a joiner's Resume was accepted.

Link copied to clipboard
@Serializable
@SerialName(value = "unpaused")
data class Unpaused(val peerId: String) : AdmitMessage

Sent by the host to every other member when a paused member's link recovered inside its reconnect window — the release counterpart of Paused (#1557).

Link copied to clipboard
@Serializable
@SerialName(value = "welcome")
data class Welcome(val assignedPeerId: String, val displayName: String, val sessionId: String, val deviceId: String? = null, val roomId: String? = null) : AdmitMessage

Sent by the host to confirm admission.