From 382e7f5c32d63a751cbb582a3b2c295747a2bdeb Mon Sep 17 00:00:00 2001 From: exane Date: Sun, 5 Jul 2015 12:27:19 +0200 Subject: [PATCH] test --- server/server.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/server.js b/server/server.js index 23bd209..6845dc9 100644 --- a/server/server.js +++ b/server/server.js @@ -17,6 +17,9 @@ global.io = require("socket.io")(app); app.listen(16918); +var admin = io.of("/admin"); + + io.on("connection", function(socket) { //global connection var user; connections.add(user = User(socket)); @@ -32,4 +35,13 @@ io.on("connection", function(socket) { //global connection io.emit("update:playerOnline", connections.length()); +}) + +admin.on("connection", function(socket) { + socket.on("sendMessage", function(msg) { + console.log("admin send msg: " + msg); + io.emit("notification", { + message: msg + }) + }) }) \ No newline at end of file