ReloadEndpoint
Handler of the reload endpoint (/reload).
The endpoint is split across two HTTP methods, both routed on the same path:
GET /reload: opens a Server-Sent Events stream that receivesreloadevents whenever a trigger occurs. In practice, browser clients served by the live preview endpoint (/live/<file>) subscribe here and use the incoming events to refresh the embedded page.POST /reload: broadcasts areloadevent to every active subscriber. The optional request body (text/plain) is forwarded as the event payload; if absent, a default value is used. In practice, Quarkdown CLI calls this endpoint after each successful compilation.
Functions
Handles a new SSE subscription: keeps the session open and forwards every broadcast event to it. Returns when the client disconnects (the surrounding ServerSSESession is then closed by Ktor).
Handles a reload trigger: broadcasts a reload event to every subscriber and responds with 204 No Content.