Page should not refresh when it's in background #75
Labels
No labels
bug
c:haku
c:rkgk backend
c:rkgk frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: liquidex/rkgk#75
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sometimes I notice that on my testing instance, which is behind an nginx proxy, the page refreshes in the background. This is because nginx closes the connection after a certain period of inactivity—not receiving a WebSocket ping.
My theory is that browsers stop sending pings once a tab is unfocused, which causes nginx to reap the connection after some time.
This is fine and expected, but it causes the frontend to refresh even when the app is inactive. This can cause unnecessary requests to the server despite the user being inactive. We should only attempt to refresh the page once the user focuses the tab again.
Actually, it seems like just sending our own non-WebSocket ping message would work:
http://nginx.org/en/docs/http/websocket.html
Also, it seems that we'll need to raise the timeout a bit in nginx, because Chrome will throttle timers to once per minute if the page isn't active for too long. https://developer.chrome.com/blog/timer-throttling-in-chrome-88