asNodeMap
Fold a NodeChange delta stream into a live node map.
Applies the canonical accumulator every consumer otherwise hand-writes: a NodeChange.Snapshot replaces the map wholesale (emitted on first subscription and after reconnect), NodeChange.Added/NodeChange.Updated upsert, NodeChange.Removed deletes, and the presence deltas (NodeChange.WentOffline/NodeChange.CameOnline) leave the map untouched — presence is signalled, not stored.
The first emission is an empty map (before the Snapshot lands), which makes the result directly usable with stateIn:
val nodes: StateFlow<Map<NodeId, NodeInfo>> = client.nodeMap()
.stateIn(scope, SharingStarted.WhileSubscribed(5_000), emptyMap())Content copied to clipboard
Since
0.2.0