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

View file

@ -554,9 +554,13 @@ Channel.prototype.sendUserlist = function (toUsers) {
Channel.prototype.sendUsercount = function (users) {
var self = this;
users.forEach(function (u) {
u.socket.emit("usercount", self.users.length);
});
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) {