MDNSAdvertisement

data class MDNSAdvertisement(val host: String, val port: Int, val serverPeerId: PeerId, val sessionName: String, val wsPath: String = DEFAULT_WS_PATH, val hostOs: MDNSAdvertisement.HostOs? = null, val fabrics: String? = null, val mcPeer: String? = null, val txtExtensions: Map<String, String> = emptyMap(), val roomKey: String? = null) : Tag

Tag carrying enough information to connect via WebSocket to a peer that was discovered via mDNS / Bonjour.

Discovery via mDNS is handled by MDNSServiceDiscoverer; connection is delegated to :kuilt-websocket. This advertisement bridges the two.

Schema versioning

PROTOCOL_VERSION is "2" (v2 schema). v1 readers silently ignore the new keys per DNS-SD rules; v2 readers tolerate missing optional keys.

Application extensions

Callers may carry arbitrary application-specific metadata via txtExtensions. Each entry is written as an additional TXT record key–value pair. kuilt does not interpret these values — they round-trip opaquely through the discover path and arrive in the MDNSAdvertisement emitted by MDNSServiceDiscoverer.

Constructors

Link copied to clipboard
constructor(host: String, port: Int, serverPeerId: PeerId, sessionName: String, wsPath: String = DEFAULT_WS_PATH, hostOs: MDNSAdvertisement.HostOs? = null, fabrics: String? = null, mcPeer: String? = null, txtExtensions: Map<String, String> = emptyMap(), roomKey: String? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Host OS families that can appear in TXT_KEY_HOST_OS.

Properties

Link copied to clipboard

Comma-separated transports the host accepts (e.g. "ws,mc").

Link copied to clipboard

IP address or hostname of the advertising peer.

Link copied to clipboard

OS family of the advertising host — for fabric selection.

Link copied to clipboard

Opaque MultipeerConnectivity handle — present only when "mc" is in fabrics.

Link copied to clipboard
open override val peerKey: String

The server's stable peer ID — unique across all mDNS advertisements.

Link copied to clipboard
val port: Int

TCP port the advertising peer's WebSocket server listens on.

Link copied to clipboard
open override val roomKey: String?

The stable room identity this host advertises — carried in the TXT_KEY_ROOM TXT entry when non-null. A joiner reads it back and targets it in its admission handshake; null (the backward-compatible default) means the host advertises no explicit room and admits without a room check. See Tag.roomKey.

Link copied to clipboard

The advertising peer's PeerId.

Link copied to clipboard
open override val sessionName: String

Human-readable service name from the mDNS TXT record.

Link copied to clipboard

Arbitrary application-supplied TXT record key–value pairs. These are written into the mDNS TXT record alongside the kuilt-owned fields and recovered verbatim by MDNSServiceDiscoverer. Keys must not collide with the kuilt-reserved constants in Companion.

Link copied to clipboard

WebSocket path to connect to (default: DEFAULT_WS_PATH).

Link copied to clipboard

WebSocket URL derived from host, port, and path.