From c5a9d5cefecad2836c00e5d611c20bce7c36b049 Mon Sep 17 00:00:00 2001 From: lefteris Date: Mon, 29 Mar 2021 00:10:55 +0300 Subject: [PATCH] latest --- swarmlab-app/src/run/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index ecc1fdb5..accdcaee 100644 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -125,6 +125,9 @@ app.get("/test", (req, res) => { console.log("reading from db...."); +// Lefos-- variable poy krata to trexon room tou xrhsth kathe fora +var curRoom; + var url = "mongodb://mongo:27017/"; MongoClient.connect(url, function (err, db) { if (err) throw err; @@ -154,7 +157,7 @@ function onCollectionNew(err, collection) { // }); // Pernaw karfota to room pros to paron - io.in("cs141082@uniwa.gr").emit("logsend", obj); + io.in(curRoom).emit("logsend", obj); }); } @@ -213,6 +216,8 @@ io.on("connection", (s) => { s.join(room); console.log("joining rooom", s.rooms); console.log(room + " created "); + //LEFOS == Krataw to room gia na douleuei on event dunamika se kathe xrhsth + curRoom = room; // }); } }, 30000); @@ -265,6 +270,7 @@ async function checkToken(token) { return res.data; } else { console.log("noerror: " + res); + return res.status; } } catch (err) {