Hwaro::Services::LiveReloadHandler
Inherits HTTP::Handler < Reference < Object
Constants
Sent by the client script on connect to opt in to css: messages.
How many outbound messages one client may fall behind by. Broadcast enqueues here instead of writing to the socket, so a tab that handshakes and then stops reading (suspended laptop, paused debugger, a hand-rolled client left open) can absorb this many messages before we give up on it. The watcher emits at most one message per rebuild, so a client this far behind is wedged, not merely slow.
Instance methods
Push a build-error message so connected browsers can render an
overlay. The message is a single line error:<json> so the
client side can split on the first colon and parse the rest;
using JSON keeps the schema extensible (we may want to add
file, line, etc. later) without ad-hoc string parsing.
A rebuild changed only stylesheets: clients that opted in (see
CSS_SWAP_HELLO) swap the <link rel="stylesheet">s whose path ends
with one of paths (every same-origin one when paths is empty)
without reloading; any other client reloads as before.