Why AJAX? Are you not using the Multiplayer plugin?
After receiving every successful ping on the host, you can restart a timer, for example "Player1IsAlive" for 10 seconds. When this timer triggers, this means that the host hasn't received a ping from this player for 10 seconds.
I'm not using the Multiplayer plugin, everything is done with Ajax.
I looked at your example, but not absolutely sure how to implement it.
You wouldn't know if there is a way to disable the red cross that closes the game with NW.js applications or playable ad? or even a setting to remove the window around the application? That would be an easy solution, so then the player is forced to click on the leave button.
Thanks.
Regards,
Edgar