Merge branch 'production'
This commit is contained in:
commit
624a1811bc
|
@ -87,7 +87,7 @@ class SocketServer extends WebSocketEvents {
|
||||||
cheapDetector(user.ip);
|
cheapDetector(user.ip);
|
||||||
|
|
||||||
ws.send(OnlineCounter.dehydrate({
|
ws.send(OnlineCounter.dehydrate({
|
||||||
online: this.wss.clients.size || 0,
|
online: ipCounter.amount() || 0,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ip = getIPFromRequest(req);
|
const ip = getIPFromRequest(req);
|
||||||
|
@ -282,7 +282,7 @@ class SocketServer extends WebSocketEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
onlineCounterBroadcast() {
|
onlineCounterBroadcast() {
|
||||||
const online = this.wss.clients.size || 0;
|
const online = ipCounter.amount() || 0;
|
||||||
webSockets.broadcastOnlineCounter(online);
|
webSockets.broadcastOnlineCounter(online);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ export default class Counter<T> {
|
||||||
this.map = new Map();
|
this.map = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
amount(): number {
|
||||||
|
return this.map.size;
|
||||||
|
}
|
||||||
|
|
||||||
get(item: T): number {
|
get(item: T): number {
|
||||||
const count = this.map.get(item) || 0;
|
const count = this.map.get(item) || 0;
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user