mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Sending some info to adminpanel
This commit is contained in:
@@ -65,11 +65,13 @@ module.exports = function() {
|
||||
socket.on("get_spread", function(){
|
||||
db.collection("connected_users").find({"_id": "total_users"}, function(err, tot) {
|
||||
db.collection("connected_users").find({"_id": "offline_users"}, function(err, off) {
|
||||
if(tot.length > 0 && off.length == 0) {
|
||||
socket.emit("spread_listeners", {offline: 0, total: tot[0].total_users});
|
||||
} else if(tot.length > 0 && off.length > 0){
|
||||
socket.emit("spread_listeners", {offline: off[0].users.length, total: tot[0].total_users});
|
||||
}
|
||||
db.collection("connected_users").find({"_id": {$ne: "total_users"}, "_id": {$ne: "offline_users"}}, function(err, users_list) {
|
||||
if(tot.length > 0 && off.length == 0) {
|
||||
socket.emit("spread_listeners", {offline: 0, total: tot[0].total_users, online_users: users_list});
|
||||
} else if(tot.length > 0 && off.length > 0){
|
||||
socket.emit("spread_listeners", {offline: off[0].users.length, total: tot[0].total_users, online_users: users_list});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user