1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add status support to the redisout node.

This commit is contained in:
Mark Hindess 2014-07-16 13:52:47 +01:00
parent 17a83436b3
commit 79853d8583

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;