send time in messages, and also make sure that there are no phantom users (it will happen when a user's connection is suddenly stopped, or their ip changes)

This commit is contained in:
2026-07-21 20:55:03 +02:00
parent 820e281ac5
commit b670a74bb3
4 changed files with 37 additions and 75 deletions
+1 -1
View File
@@ -229,7 +229,7 @@ function handleData(wss, receivedData, rdsWss) {
}).catch((error) => console.log("Error fetching Tx info:", error));
// Send the updated data to the client
const dataToSendJSON = JSON.stringify(dataToSend);
const dataToSendJSON = JSON.stringify({...dataToSend, timestamp: Math.floor(Date.now() / 1000)});
if (currentTime - lastUpdateTime >= updateInterval) {
wss.clients.forEach((client) => client.send(dataToSendJSON));
lastUpdateTime = Date.now();