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