PeerDiscoverySource

A transport-agnostic feed of peer advertisements.

Each transport module provides its own implementation: MDNSServiceDiscoverer for Bonjour, MultipeerServiceBrowser for Apple MultipeerConnectivity, and so on. The lobby controller composes a list of these and merges their flows so the UI sees one unified roster.

Implementations expose a narrower return type via Kotlin's covariant-return support (e.g. Flow<MDNSAdvertisement>); direct callers keep their typed APIs while the lobby treats every source as Flow<Tag>.

Properties

Link copied to clipboard
abstract val kind: DiscoveryKind

Identifies the underlying transport (mDNS, MultipeerConnectivity, …).

Functions

Link copied to clipboard
open fun departures(): Flow<String>

Cold flow that emits a Tag.peerKey for every peer that leaves the network. Implementations that do not support departure events (e.g. test fakes that emit a fixed roster) may return emptyFlow.

Link copied to clipboard
abstract fun discoveries(): Flow<Tag>

Cold flow that emits a Tag for every peer the source discovers. Stays open until the collector's scope is cancelled.