heartbeat

fun ServerSSESession.heartbeat(heartbeatConfig: Heartbeat.() -> Unit = {})(source)

Starts a heartbeat for the ServerSSESession.

The heartbeat will send the specified Heartbeat.event at the specified Heartbeat.period interval as long as the session is active, or invoke Heartbeat.eventProvider on each tick when set. Only one heartbeat can be started per session. The heartbeat is stopped when the session handler returns; calling this function after that has no effect.

Report a problem

Parameters

heartbeatConfig

a lambda that configures the Heartbeat object used for the heartbeat.

Throws

if a heartbeat has already been started for this session.