Instance chart
Provides data about other instances on the same machine/network
See also:
This crate provides a lightweight alternative to mDNS. It discovers other instances on the
same network or (optionally) machine. You provide an Id and some data you want to share.
Usually this is a port your service uses. This gives you a live updating chart
of all the discovered Ids-data pairs and the corrosponding ip adresses.
The chart can contain instances that are now down. It can not be used to check if a service is up.
Usage
Add a dependency on instance-chart in Cargo.toml:
= "0.3"
Now add the following snippet somewhere in your codebase. Discovery will stop when you drop the maintain future.
use Error;
use ;
async
Example App
A minimal peer to peer chat app using instance-chart to discover peers. After type a line the message is sent to all the peers simply by looping over their addresses returned by chart.addr_vec().
async
For the full working example including the print_incoming function see examples/chat.rs.