mirror of https://github.com/calzoneman/sync.git
Improve performance of mass connects by broadcasting usercount
This commit is contained in:
parent
98d3090c7d
commit
76ef8d6906
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue