Stale counts when viewed on the phone
Closed this issue · 3 comments
yarikoptic commented
r03ert0 commented
these are the posters I see having residual counts: 715, 758, 898, 900, 1260, 1353, 1914, 1939, 2038, 2179
earlier today, poster 1939 had count=7, now it's at count=11...
soichih commented
I am guessing that beforeunload event is somehow not getting fired, or maybe some browser that doesn't quite have time to send the jitclose event. I've updated the room.html so that it will ping the server that client is still there (every 30 seconds), so that I can later update the serverside code to clean up the stale count if polling stops coming. Right now, I am keeping old counts up to 2 hours.
@katjaq Can you update wss.onopen handle to have the setInterval()?
wss.onopen = () => {
wss.send(JSON.stringify({action: "jit", id, cid}));
setInterval(()=>{
wss.send(JSON.stringify({action: "jit", id, cid}));
}, 1000*30);
}