Clock read once per Set/Extend to anchor the countdown; injectable for tests.
ReadonlyDeadline$Emits the current deadline (or null when none is known), then every change.
ReadonlyReached$Emits once when the deadline is reached.
ReadonlyWarning$Emits once per configured warning offset as its moment arrives; remainingMs is that offset.
The options of the current arming (defaults { autoEnd: true, warnBeforeMs: [] }).
The current deadline, or null when none is known.
Forgets the deadline (session ended), cancels every timer and restores the default options, so the next call does not inherit this one's.
Cancels every timer and completes the streams; later calls are no-ops.
Applies a server-announced deadline: adopted when none is known or when it is LATER than the one held; ignored when earlier, equal or unparseable. Keeps the options and re-arms every timer. Returns whether the deadline changed.
Sets the baseline deadline outright (a host that knows the session's cap at start) and arms the alarm. null clears it. A second call replaces the options.
Optionaloptions: SessionDeadlineOptions
The client's view of when its session must end — the CLIENT half of a limit the server enforces authoritatively (the janitor closes a session past its stored deadline whatever a client does).
It holds the deadline, runs the alarm for it (
Warning$ahead of the deadline,Reached$at it) and follows one rule: the server's word moves the deadline only later when it arrives as an extension (identity verification relaxes a session's limits). A stale or hostile value can never pull the deadline earlier, and nothing a client does with this class extends the server's deadline. "Never cut a session short here" describes the VALUE this class holds, not the runtime's behaviour: whenReached$fires the runtime may end the session, because that is the deadline the host asked for.Time counts down by elapsed time measured by the timers from the moment the deadline was set or extended, never by comparing the wall clock to the deadline at fire time, so a laptop clock that is behind cannot fire late and let the server cut first. The class never ends a session:
Reached$emits synchronously inside the timer callback and the runtime decides what follows.