fix -in node connect event logic from being backwards
and remove extraneous debug
This commit is contained in:
parent
aff51c116a
commit
f8a4f4207e
@ -1,6 +1,6 @@
|
||||
### Change Log for Node-RED Worldmap
|
||||
|
||||
- v2.1.0 - Add ui-worldmap node to make embedding in Dashboard easier. Let in node specify connection actions only.
|
||||
- v2.1.0 - Add ui-worldmap node to make embedding in Dashboard easier. Let -in node specify connection actions only.
|
||||
- v2.0.22 - fix SIDC missing property
|
||||
- v2.0.21 - allow adding overlays without making them visible (visible:false). Issue #108
|
||||
- v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.
|
||||
|
@ -7,7 +7,7 @@ map web page for plotting "things" on.
|
||||
|
||||
### Updates
|
||||
|
||||
- v2.1.0 - Add ui-worldmap node to make embedding in Dashboard easier.
|
||||
- v2.1.0 - Add ui-worldmap node to make embedding in Dashboard easier. Let -in node specify connection actions only.
|
||||
- v2.0.22 - fix SIDC missing property
|
||||
- v2.0.21 - allow adding overlays without making them visible (visible:false). Issue #108
|
||||
- v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.
|
||||
|
11
worldmap.js
11
worldmap.js
@ -219,17 +219,18 @@ module.exports = function(RED) {
|
||||
node.status({fill:"green",shape:"dot",text:"connected "+Object.keys(clients).length,_sessionid:client.id});
|
||||
client.on('data', function(message) {
|
||||
message = JSON.parse(message);
|
||||
console.log("GOT:",message);
|
||||
if ((node.events === "connect") && message.hasOwnProperty("action") && (message.action === "connected")) {
|
||||
setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id})});
|
||||
} else {
|
||||
if (node.events !== "connect") {
|
||||
setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id})});
|
||||
}
|
||||
else {
|
||||
if (message.hasOwnProperty("action") && (message.action === "connected")) {
|
||||
setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id})});
|
||||
}
|
||||
}
|
||||
});
|
||||
client.on('close', function() {
|
||||
delete clients[client.id];
|
||||
node.status({fill:"green",shape:"ring",text:"connected "+Object.keys(clients).length,_sessionid:client.id});
|
||||
console.log("BYE:",node.events);
|
||||
if (node.events !== "connect") {
|
||||
node.send({payload:{action:"disconnect", clients:Object.keys(clients).length}, topic:node.path.substr(1), _sessionid:client.id});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user