I'm working on a Ruby on Rails application with Action Cable. Watching the logs, I've noticed that when I put my phone to sleep that the WebSocket is closed automatically, so further updates are not received. However, on wake (directly to the page, or opening the browser again and giving the tab focus) the connection is immediately re-established.
I want to refresh the page at this moment so that it's up-to-date. The "focus" event is not useful, as it will trigger whenever desktop users bounce between windows or tabs.
What event can I use to reload the page on wake? Something must be available, as Action Cable is reconnecting (though I realize it may be using the focus event as well and simply checking if a connection exists or not).