show unique user count in acp

v1.18.x
Barış Soner Uşaklı 9 years ago
parent 91312a0c5b
commit b147f42f0a

@ -225,6 +225,7 @@ Sockets.getUserSocketCount = function(uid) {
if (!io) { if (!io) {
return 0; return 0;
} }
var room = io.sockets.adapter.rooms['uid_' + uid]; var room = io.sockets.adapter.rooms['uid_' + uid];
return room ? room.length : 0; return room ? room.length : 0;
}; };
@ -233,8 +234,14 @@ Sockets.getOnlineUserCount = function() {
if (!io) { if (!io) {
return 0; return 0;
} }
var room = io.sockets.adapter.rooms.online_users; var count = 0;
return room ? room.length : 0; for (var key in io.sockets.adapter.rooms) {
if (io.sockets.adapter.rooms.hasOwnProperty(key) && key.startsWith('uid_')) {
++ count;
}
}
return count;
}; };
Sockets.getOnlineAnonCount = function () { Sockets.getOnlineAnonCount = function () {

Loading…
Cancel
Save