mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
6d2793cac6
commit
036a825892
@ -105,8 +105,11 @@ module.exports = function(RED) {
|
||||
if (node.isServer) {
|
||||
node._clients[id] = socket;
|
||||
node.emit('opened',{count:Object.keys(node._clients).length,id:id});
|
||||
} else {
|
||||
}
|
||||
socket.on('open',function() {
|
||||
if (!node.isServer) {
|
||||
if (node.heartbeat) {
|
||||
clearInterval(node.heartbeatInterval);
|
||||
node.heartbeatInterval = setInterval(function() {
|
||||
if (socket.nrPendingHeartbeat) {
|
||||
// No pong received
|
||||
@ -115,12 +118,11 @@ module.exports = function(RED) {
|
||||
return;
|
||||
}
|
||||
socket.nrPendingHeartbeat = true;
|
||||
try {
|
||||
socket.ping();
|
||||
} catch(err) {}
|
||||
},node.heartbeat);
|
||||
}
|
||||
}
|
||||
socket.on('open',function() {
|
||||
if (!node.isServer) {
|
||||
node.emit('opened',{count:'',id:id});
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user