Added client side handler for lastseen
This commit is contained in:
parent
18c367040d
commit
b3be0120fa
|
@ -5554,12 +5554,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
for (var j in docs) {
|
for (var j in docs) {
|
||||||
var nodeid = docs[j]._id.substring(2);
|
var nodeid = docs[j]._id.substring(2);
|
||||||
if (LCs[nodeid] != null) {
|
if (LCs[nodeid] != null) {
|
||||||
delete docs[j]._id;
|
LCs[nodeid] = docs[j].time;
|
||||||
LCs[nodeid] = docs[j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(LCs);
|
try { ws.send(JSON.stringify({ action: 'lastseen', lastconnects: LCs })); } catch (ex) { }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2291,6 +2291,14 @@
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'lastseen': {
|
||||||
|
var lcnodes = Object.keys(message.lastconnects);
|
||||||
|
for (var i in lcnodes) {
|
||||||
|
var lcnodeid = lcnodes[i];
|
||||||
|
var node = getNodeFromId(lcnodeid);
|
||||||
|
if (node != null) { node.lastconnect = message.lastconnects[lcnodeid] }
|
||||||
|
}
|
||||||
|
}
|
||||||
case 'msg': {
|
case 'msg': {
|
||||||
// Check if this is a message from a node
|
// Check if this is a message from a node
|
||||||
if (message.nodeid != null) {
|
if (message.nodeid != null) {
|
||||||
|
|
Loading…
Reference in New Issue