datalad-datasets/ohbm2020-posters

Stale counts when viewed on the phone

Closed this issue · 3 comments

Android,
Opened the page (chrome), reloaded, sorted by online. Top was 12 (real - us yesterday), joined (went into jitsi app) -nobody, left and it went down to 11:

Screenshot_20200627-133147

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...

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);
        }

Done! :)
Thank you! @r03ert0 had the same idea and you have already implemented it! Boom :D 🔥