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 = "hello")
data class Hello(val displayName: String, val sessionId: String, val deviceId: String? = null) : AdmitMessage

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

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

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

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 = "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.