add check for ws.user again

This commit is contained in:
HF 2022-06-26 21:52:28 +02:00
parent a9c2289d4f
commit d3e6010e07
2 changed files with 5 additions and 3 deletions

View File

@ -66,8 +66,8 @@ class SocketClient extends EventEmitter {
this.readyState = WebSocket.CLOSING;
this.ws.close();
}
if (now - 43000 > this.timeLastSent) {
// make sure we send something at least all 45s
if (now - 23000 > this.timeLastSent) {
// make sure we send something at least all 25s
this.sendWhenReady(Ping.dehydrate());
}
}

View File

@ -368,7 +368,9 @@ class SocketServer {
let client = it.next();
while (!client.done) {
const ws = client.value;
if (ws.readyState === WebSocket.OPEN) {
if (ws.readyState === WebSocket.OPEN
&& ws.user
) {
const canvasId = ws.canvasId || 0;
const { ip } = ws.user;
// only count unique IPs per canvas