$ npm install afd$ component install kordon/afdvar afd = require('afd')
var peers = {}
server.on('message', function(msg) {
if(msg.type !== 'ping') return
if(!peers[server.id]) peers[server.id] = afd()
peers[server.id].report()
})
setInterval(function() {
Object.keys(peers).forEach(function (id) {
if(peers[id].phi() > 8) console.error('Node %s has probably failed!', id)
else console.log('Node %s is alive!', id)
})
}, 1000)- Original racker/node-failure-detector code is under the MIT license
- Updates from Rackspace are under the Apache 2.0 license
- Original bpot/node-gossip code is under the MIT license
- Updates from kordon/afd are under the MIT license



