node-ivy is a pure Javascript implementation of the Ivy Software Bus (http://www.eei.cena.fr/products/ivy/).
npm install node-ivy
var IvyBus = require('node-ivy');
...
var ivy = new IvyBus("MyApp", "127.255.255.255", 2010);
...
ivy.start();
var subId = ivy.subscribe(/myregex ([^ ]*) (.*)/, function(params){
console.log(params);
});
- The regex describes the format of the messages the user wants to listen to.
- Only messages that match the given regex will trigger the callback.
- params is an array containing the result of every catch block defined in the regex.
ivy.unsubscribe(subId);
ivy.send("mymessage");
ivy.on('peerConnected', function(peer){
console.log("peer "+peer.name+" connected !");
});
ivy.on('peerQuit', function(peer){
console.log("peer "+peer.name+" disconnected !");
});
ivy.stop();