The Discovery Service keeps track of neighbor nodes, as reported from the mesh.
Events notify a specific node about changes regarding its neighbors, i.e., nodes that have come in sight, or have left sight.
Discovery is used whenever you need to be aware about your peers locally near to you.
Example 1. Obtain the Discovery service handler. Note the async environment.
Discover Neighbors
Subscribe to neighbor events in order to
get notified when new neighbors are discovered or lost as adjacent nodes in the mesh.
The discovery methods return a stream of neighbour events which will emit an event whenever the local runtime detects a change
in the set of neighbors. The stream is guaranteed to emit an Init neighbor event
directly after subscribing and only Discovered and Lost events afterwards.