diff --git a/server.js b/server.js index 781c1b3..72aac63 100644 --- a/server.js +++ b/server.js @@ -56,12 +56,7 @@ orvibo.startServer(); app.get('/', (req, res) => { let sockets = orvibo.getConnectedSocket(); - - const q = req.query - if (q.uid != undefined) { - orvibo.toggleSocket(q.uid); - } - + sockets.forEach(socket => { switch(socket.state) { case 1: @@ -74,6 +69,11 @@ app.get('/', (req, res) => { } }); + const q = req.query + if (q.uid != undefined) { + orvibo.toggleSocket(q.uid); + } + res.render('index', { title: 'Orvibo b25 Server', sockets