Improve performance of mass connects by broadcasting usercount

This commit is contained in:
calzoneman 2016-02-15 21:35:59 -08:00
parent 98d3090c7d
commit 76ef8d6906
1 changed files with 7 additions and 3 deletions

View File

@ -554,9 +554,13 @@ Channel.prototype.sendUserlist = function (toUsers) {
Channel.prototype.sendUsercount = function (users) {
var self = this;
if (users === self.users) {
self.broadcastAll("usercount", self.users.length);
} else {
users.forEach(function (u) {
u.socket.emit("usercount", self.users.length);
});
}
};
Channel.prototype.sendUserJoin = function (users, user) {