Skip to content

Node.js based forum software built for the modern web

debug

barisusakli536286358898
diff --git a/src/socket.io/index.js b/src/socket.io/index.js
index 8dc75a4b77..50ce5023a5 100644
--- a/src/socket.io/index.js
+++ b/src/socket.io/index.js
@@ -388,7 +388,17 @@ function emitOnlineUserCount(callback) {
}
}
-
+Sockets.debug = function(callback) {
+ var uids = [];
+ //var clients = io.sockets.clients('uid_1');
+ var clients = io.sockets.clients('/');
+ for(var i=0; i<clients.length; ++i) {
+ if (clients[i].uid !== 0 && uids.indexOf(clients[i].uid) === -1) {
+ uids.push(clients[i].uid);
+ }
+ }
+ callback(null, uids);
+}
diff --git a/src/socket.io/user.js b/src/socket.io/user.js
index fa1a063fc7..83a69df752 100644
--- a/src/socket.io/user.js
+++ b/src/socket.io/user.js
@@ -280,6 +280,10 @@ SocketUser.getActiveUsers = function(socket, data, callback) {
module.parent.exports.emitOnlineUserCount(callback);
};
+SocketUser.debug = function(socket, data, callback) {
+ module.parent.exports.debug(callback);
+};
+
SocketUser.loadMore = function(socket, data, callback) {
if(!data || !data.set || parseInt(data.after, 10) < 0) {
return callback(new Error('[[error:invalid-data]]'));