This commit is contained in:
Jon Eugster
2023-05-04 16:05:14 +02:00
parent c4e63687c0
commit 93b02883b3
+3 -3
View File
@@ -92,7 +92,7 @@ wss.addListener("connection", function(ws, req) {
fillQueue(gameId)
}
this.socketCounter += 1;
socketCounter += 1;
const ip = anonymize(req.headers['x-forwarded-for'] || req.socket.remoteAddress)
console.log(`[${new Date()}] Socket opened - ${ip}`)
@@ -115,12 +115,12 @@ wss.addListener("connection", function(ws, req) {
return message;
});
console.log(`[${new Date()}] Number of open sockets - ${this.socketCounter}`)
console.log(`[${new Date()}] Number of open sockets - ${socketCounter}`)
console.log(`[${new Date()}] Free RAM - ${Math.round(os.freemem() / 1024 / 1024)} / ${Math.round(os.totalmem() / 1024 / 1024)} GB`)
ws.on('close', () => {
console.log(`[${new Date()}] Socket closed - ${ip}`)
this.socketCounter -= 1;
socketCounter -= 1;
})
socketConnection.onClose(() => serverConnection.dispose());