diff --git a/index.js b/index.js index e5cb75b..f7ae463 100644 --- a/index.js +++ b/index.js @@ -351,18 +351,16 @@ $(document).ready(function () { World.spawn(wsconn); World.spawn({ // Monitor connection, notifying connectivity changes - state: null, + state: "crashed", // start with this to avoid spurious initial message print boot: function () { World.updateRoutes([sub(["broker_state", __], 0, 1)]); }, handleEvent: function (e) { if (e.type === "routes") { - if (e.routes.length > 0) { - var newState = e.routes[0].pattern[1]; - if (this.state != newState) { - outputState(newState); - this.state = newState; - } + var newState = (e.routes.length > 0) ? e.routes[0].pattern[1] : "crashed"; + if (this.state != newState) { + outputState(newState); + this.state = newState; } } } diff --git a/style.css b/style.css index 7d581ee..a19cf9d 100644 --- a/style.css +++ b/style.css @@ -30,6 +30,15 @@ span.state.disconnected, span.departed { color: #c00000; } +span.state.crashed { + color: white; + background: red; +} + +span.state.crashed:after { + content: "; please reload the page"; +} + div.state_disconnected { background-color: #ffeeee; }