Add node status updates

This commit is contained in:
Nick O'Leary
2014-05-08 14:15:54 +01:00
parent 8e7fc011f0
commit 7ecb80bf40
7 changed files with 145 additions and 42 deletions

View File

@@ -20,7 +20,7 @@ var clone = require("clone");
var flows = require("./flows");
var comms = require("../comms");
function Node(n) {
this.id = n.id;
@@ -114,6 +114,11 @@ Node.prototype.error = function(msg) {
if (this.name) o.name = this.name;
this.emit("log",o);
}
/**
* status: { fill:"red|green", shape:"dot|ring", text:"blah" }
*/
Node.prototype.status = function(status,retain) {
comms.publish("status/"+this.id,status,retain);
}
module.exports = Node;