Otherwise, when simply clicking a link to navigate away from the page,
this scary-looking red box can appear. Nobody should complain if it
takes a few seconds for the game to notice a connection is lost.
events.onerror = function(event) {
if (event.target.readyState === EventSource.CLOSED) {
events.onerror = function(event) {
if (event.target.readyState === EventSource.CLOSED) {
add_message("danger", "Connection to server lost.");
add_message("danger", "Connection to server lost.");