Look for WebRTC, an API primarily aimed at video/audio chat but that will allow to also send any type of data in a p2p way.
It's not there yet, but it is in development.
For your second issue, I'd suspect that the process of the game itself is frozen when the tab has lost focus, and so the websocket can't produce the Ping/Pong. I guess it's part of the standard itself.
A workaround could be to warn the player to not change tabs when they are playing, and if it happens, "intercept" it with the Browser trigger "On suspended" sending a "Self-kick" message to your server and a "rejoin" message "On resumed".
Handle a sort of pause for the player's entity in the current game, without needing to keep the connexion alive.
You can set a timeout period on your server for the entities which were "paused" for too long, or when the current game is over.
When the player joins again ("On resumed") activate the connexion again and place the entity into play again.