observePeersV2

fun observePeersV2(handler: (String) -> Unit): DittoPeersObserver

Request information about Ditto peers in the local peer-to-peer network. The V2 observer differs from observePeers by providing not just information about the immediate peers, but also multihop information from other peers not immediately connected. V2 presence therefore offers a more complete view of the local peer-to-peer network.

This method returns an observer which will invoke the provided lambda expression for each update. A newly registered observer will have an update delivered to it immediately. Then it will be invoked repeatedly when new information is learned about Ditto peers or their connections in the local peer-to-peer network.

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

V2

Parameters

handler

the lambda expression to be invoked when there is an update.


fun observePeersV2(callback: DittoPeersObserverV2Callback): DittoPeersObserver

Request information about Ditto peers in the local peer-to-peer network. The V2 observer differs from observePeers by providing not just information about the immediate peers, but also multihop information from other peers not immediately connected. V2 presence therefore offers a more complete view of the local peer-to-peer network.

This method returns an observer which will invoke the update method on the provided callback object for each update. A newly registered observer will have an update delivered to it immediately. Then it will be invoked repeatedly when new information is learned about Ditto peers or their connections in the local peer-to-peer network.

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

V2

Parameters

callback

an object that implements the DittoPeersObserverV2Callback interface, whose update function will be called when there is an update.