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

Decrement connected client count rather than show disconnected

to close #1577
This commit is contained in:
Dave Conway-Jones 2018-01-25 13:27:47 +00:00
parent d26fb02bb9
commit 0b0005337c
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -206,7 +206,10 @@ module.exports = function(RED) {
// TODO: nls // TODO: nls
this.serverConfig.on('opened', function(n) { node.status({fill:"green",shape:"dot",text:"connected "+n}); }); this.serverConfig.on('opened', function(n) { node.status({fill:"green",shape:"dot",text:"connected "+n}); });
this.serverConfig.on('erro', function() { node.status({fill:"red",shape:"ring",text:"error"}); }); this.serverConfig.on('erro', function() { node.status({fill:"red",shape:"ring",text:"error"}); });
this.serverConfig.on('closed', function() { node.status({fill:"red",shape:"ring",text:"disconnected"}); }); this.serverConfig.on('closed', function(n) {
if (n > 0) { node.status({fill:"green",shape:"dot",text:"connected "+n}); }
else { node.status({fill:"red",shape:"ring",text:"disconnected"}); }
});
} else { } else {
this.error(RED._("websocket.errors.missing-conf")); this.error(RED._("websocket.errors.missing-conf"));
} }
@ -231,7 +234,10 @@ module.exports = function(RED) {
// TODO: nls // TODO: nls
this.serverConfig.on('opened', function(n) { node.status({fill:"green",shape:"dot",text:"connected "+n}); }); this.serverConfig.on('opened', function(n) { node.status({fill:"green",shape:"dot",text:"connected "+n}); });
this.serverConfig.on('erro', function() { node.status({fill:"red",shape:"ring",text:"error"}); }); this.serverConfig.on('erro', function() { node.status({fill:"red",shape:"ring",text:"error"}); });
this.serverConfig.on('closed', function() { node.status({fill:"red",shape:"ring",text:"disconnected"}); }); this.serverConfig.on('closed', function(n) {
if (n > 0) { node.status({fill:"green",shape:"dot",text:"connected "+n}); }
else { node.status({fill:"red",shape:"ring",text:"disconnected"}); }
});
} }
this.on("input", function(msg) { this.on("input", function(msg) {
var payload; var payload;