fully-connected-topology
Node module to create a network with a fully connected topology.
npm install fully-connected-topology
Usage
var topology = ;var t1 = ;var t2 = ;var t3 = ;t1;t2;t3;
If you run the above example it should print that everyone is connected to everyone. If a connection is destroyed the topology will try to reconnect it.
API
var t = topology(ownHost, [peer1, peer2, ...])
Creates a new topology. A local server will be started on the port specified in ownHost
.
t.add(peer)
Add a peer after the topology has been created
t.remove(peer)
Remove a peer after the topology has been created
t.destroy()
Destroy the topology and all current connections
var socket = t.peer(addr)
Get the socket for a specific peer. Returns null
if peer isn't connected.
t.connections
An array of all the current connections
t.on('connection', function(connection, peer) {})
Emitted when a new connection is established.
License
MIT