ditto-lib / live.ditto / DittoKit / observePeers

observePeers

fun observePeers(handler: (List<RemotePeer>) -> Unit): PeersObserver

Request information about Ditto peers in range of this device.

This method returns an observer which will invoke the provided lambda for each update. A newly registered observer will have a peers update delivered to it immediately. Then it will be invoked repeatedly when Ditto devices come and go, or the active connections to them change.

When the observer is no longer required the caller must call close() on the returned PeersObserver.