|
|
@ -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) { |
|
|
|