Looks like recent policy changes in Chrome (throttling JavaScript timer wake-ups) forces WebSocket connection termination in 5-7 minutes of tab inactivity.
Also see this question on Stackoverflow.
Safari seems to close the connection in exactly 5 mins of inactivity.
My JavaScript client version is v2.2.0