ReloadTrigger

class ReloadTrigger(host: String = SERVER_HOST, port: Int, endpoint: String)

Stateless trigger for live-preview reloads.

Each call performs a fire-and-forget POST to the server's reload endpoint; the server then broadcasts the event to every connected Server-Sent Events subscriber. Unlike a persistent session, there is no connection to keep alive: a failed call simply means no clients will reload, and the next attempt is independent.

Parameters

host

server hostname

port

server port to contact

endpoint

reload endpoint path (with leading slash)

Constructors

Link copied to clipboard
constructor(host: String = SERVER_HOST, port: Int, endpoint: String)

Functions

Link copied to clipboard
fun close()

Releases the underlying HTTP client. After this call no further triggers can be sent.

Link copied to clipboard
fun trigger()

Sends a reload trigger to the server. Errors are logged but not rethrown, since a missed reload is recoverable: the next compile will issue another.