Browse Source

global

master
zeus 4 years ago
parent
commit
201d1f0d35
  1. 14
      swarmlab-app/src/run/app.js

14
swarmlab-app/src/run/app.js

@ -298,7 +298,7 @@ cors(corsOptions), (req, res, next) => {
var reslog = new Object(); var reslog = new Object();
reslog.log = obj reslog.log = obj
reslog.test = usersession.SOCKET.user //reslog.test = usersession.SOCKET.user
//var n = {} //var n = {}
//n.year = now.getFullYear(); //n.year = now.getFullYear();
//n.month = now.getMonth(); //n.month = now.getMonth();
@ -311,8 +311,10 @@ cors(corsOptions), (req, res, next) => {
reslog.date = convertDateToUTC(now) reslog.date = convertDateToUTC(now)
console.log(reslog); console.log(reslog);
console.log("IOT "+JSON.stringify(reslog));
io.emit("logdata", reslog); console.log("IOTuser "+JSON.stringify(global));
// io.in("iot").emit("message", reslog);
// io.emit("logdata", reslog);
/* /*
for (var key in obj){ for (var key in obj){
var value = obj[key]; var value = obj[key];
@ -378,6 +380,12 @@ io.on('connection', s => {
if (!s.auth) { if (!s.auth) {
console.log("Disconnecting timeout socket ", s.id); console.log("Disconnecting timeout socket ", s.id);
s.disconnect('unauthorized'); s.disconnect('unauthorized');
}else{
var room = usersession.SOCKET.user
//s.on("subscribe", function (room) {
// console.log("joining room", room);
s.join(room);
// });
} }
}, 30000); }, 30000);

Loading…
Cancel
Save