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 receives reload events 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 a reload event 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.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
suspend fun handleSubscription(session: ServerSSESession)

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).

Link copied to clipboard
suspend fun handleTrigger(call: ApplicationCall)

Handles a reload trigger: broadcasts a reload event to every subscriber and responds with 204 No Content.