diff --git a/public/src/app.js b/public/src/app.js index 88b2b51f24..bde0fc4e71 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -182,6 +182,7 @@ var socket, app.current_room = null; app.enter_room = function(room) { + console.log(room) if (app.current_room === room) return; socket.emit('event:enter_room', { diff --git a/public/templates/admin/footer.tpl b/public/templates/admin/footer.tpl index 7fdd8d9af2..f5fc244c4b 100644 --- a/public/templates/admin/footer.tpl +++ b/public/templates/admin/footer.tpl @@ -24,6 +24,7 @@ }, false); }); + }()) diff --git a/public/templates/admin/index.tpl b/public/templates/admin/index.tpl index 8140753570..ab022f15b7 100644 --- a/public/templates/admin/index.tpl +++ b/public/templates/admin/index.tpl @@ -26,17 +26,19 @@ socket.on('api:get_all_rooms', function(data) { var active_users = document.getElementById('active_users'), total = 0; - + active_users.innerHTML = ''; + for(var room in data) { if (room !== '') { var count = data[room].length; total += count; - active_users.innerHTML = active_users.innerHTML + "
" + room + " " + count + " active user" + (count > 1 ? "s" : "") + "

"; + active_users.innerHTML = active_users.innerHTML + "
" + room + " " + count + " active user" + (count > 1 ? "s" : "") + "
"; } } document.getElementById('connections').innerHTML = total; }); + app.enter_room('admin'); socket.emit('api:get_all_rooms'); \ No newline at end of file diff --git a/src/topics.js b/src/topics.js index 4280e09882..bd02ac8405 100644 --- a/src/topics.js +++ b/src/topics.js @@ -140,7 +140,7 @@ var RDB = require('./redis.js'), // Global Topics if (uid == null) uid = 0; if (uid !== null) { - RDB.lpush('topics:tid', tid); + RDB.db.sadd('topics:tid', tid); } else { // need to add some unique key sent by client so we can update this with the real uid later RDB.lpush('topics:queued:tid', tid); diff --git a/src/websockets.js b/src/websockets.js index 928c02a75a..ca843ab3f0 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -66,7 +66,6 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}), }); socket.on('api:get_all_rooms', function(data) { - console.log('recieve'); socket.emit('api:get_all_rooms', io.sockets.manager.rooms); }) @@ -101,6 +100,8 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}), anonymous: anonymous }); }); + + if (data.enter != 'admin') io.sockets.in('admin').emit('api:get_all_rooms', io.sockets.manager.rooms); });