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

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

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;