Home

Awesome

verbose Build Status

Distributed event bus

Features

Create a Node

var verbose = require('verbose');
var node = verbose();

You can also give it some options:

var options = {
  node_id: 'NODE-ID-000001'
};

var node = verbose(options);

Here are the options:

optiondescriptiondefault
node_idnode identifier for other peersrandom UUID
timeoutinactivity timeout (ms)60000
bufferTimeoutmaximum retransmit resilience900000
bufferMaxmaximum number of buffered messages kept by peer1000
acknowledgeIntervalmessage acknowledge interva (ms)1000
maxPeersmessage acknowledge interva (ms)1000
transporttransport name or object. If object, must provide a listen and a connect methods. See example"tcp"

Make it listen

node.listen(port);

Connect to another node in another process

node.connect(port[, host]);

Emit events on a node

node.emit('event', 'a', 1);

Receive events

node.on('event', function() {
  console.log('got event:', arguments);
});

End a Node

node.end();

Underlying stream

You can access the underlying stream:

node.stream.on('end', function() {
  console.log('node ended');
});

Besides being a duplex stream, it emits the following events:

Peer control

When connecting you can get access to the peer object:

var peer = node.connect(port, host);

Which you can then use to end:

peer.end();

Licence

MIT