Merge pull request #274 from hindessm/redis-status

Add status support to the redisout node.
This commit is contained in:
Nick O'Leary 2014-07-17 09:07:29 +01:00
commit 2b423fe9be
1 changed files with 15 additions and 1 deletions

View File

@ -62,7 +62,21 @@ module.exports = function(RED) {
this.structtype = n.structtype;
this.client = redisConnectionPool.get(this.hostname,this.port);
if (this.client.connected) {
this.status({fill:"green",shape:"dot",text:"connected"});
} else {
this.status({fill:"red",shape:"ring",text:"disconnected"},true);
}
var node = this;
this.client.on("end", function() {
node.status({fill:"red",shape:"ring",text:"disconnected"});
});
this.client.on("connect", function() {
node.status({fill:"green",shape:"dot",text:"connected"});
});
this.on("input", function(msg) {
if (msg != null) {
var k = this.key || msg.topic;