Skip to main content

Module livereload

Module livereload 

Source
Expand description

Server-Sent Events live-reload broadcaster.

LiveReload holds a tokio::sync::broadcast channel and an actix handler that streams events to connected browsers. Cheap to clone — the underlying Sender is itself an Arc-like type.

§Wire protocol

The browser opens an EventSource connection and listens for two named events:

  • reload — successful rebuild; the page should refresh.
  • reload-error — rebuild failed; the page logs the message and waits for the next event without reloading.

A 30-second :heartbeat comment keeps the connection alive through intermediate proxies that drop idle TCP streams.

Structs§

LiveReload
SSE live-reload broadcaster. Cheap to clone; share across handlers.

Enums§

ReloadEvent
A live-reload event. Keep this enum stable; both the wire format and the broadcast subscribers depend on it.

Functions§

sse_handler
Actix handler for the SSE endpoint.