MultipeerAdvertisement

data class MultipeerAdvertisement(val handle: String, val sessionName: String, val serviceType: String, val roomKey: String? = null) : Tag

Tag for a peer discovered via Apple's MultipeerConnectivity framework.

Apple represents peers with MCPeerID objects whose lifetime is tied to the advertising peer's process. We can't surface those directly through Tag (it would leak ObjC into commonMain), so the underlying MCPeerID is held in a per-session map keyed by handle; callers pass the advertisement back to MultipeerPeerLinkFactory.join which performs the lookup.

Constructors

Link copied to clipboard
constructor(handle: String, sessionName: String, serviceType: String, roomKey: String? = null)

Properties

Link copied to clipboard

Stable opaque identifier for this peer within the current browse session. Treat it as an opaque token — its only valid use is round- tripping back to the MultipeerPeerLinkFactory that produced it.

Link copied to clipboard
open override val peerKey: String

The MC peer handle — stable within the current browse session.

Link copied to clipboard
open override val roomKey: String?

The stable room identity this joiner targets, matched against the host's room before admission. Defaults to null (permissive) — the MC service type already scopes discovery to a single room, so the transport binds the target and no host-side room check is needed. See Tag.roomKey.

Link copied to clipboard

MultipeerConnectivity service type string the peer advertised under (matches the serviceType passed to MultipeerPeerLinkFactory).

Link copied to clipboard
open override val sessionName: String

Human-readable name as broadcast by the advertising peer (matches its MCPeerID.displayName).