The plug behind Dstar.Router.dstar/2. Drives Dstar.Page callbacks:
{:page, Module}— GET:mount/2thenrender/1through Phoenix's view pipeline (root layout, flash,page_titleall apply).{:event, Module}— POST_event/:event: reads signals, optionalauthorize/2, starts SSE, callshandle_event/3.{:stream, Module}— POST: optionalauthorize/2, atomically claims dedup ownership whenstream_key/1is defined, starts SSE, callshandle_connect/2, then runs the receive loop onDstar.Stream, dispatching tohandle_info/2. A keyed claim failure returns 503 before the callback.
authorize/2 is the pre-SSE seam: a halted or already-staged
response is returned as ordinary HTTP and SSE never starts.
Before authorization, signals are fetched with the page's
:max_signal_bytes limit; malformed/non-object payloads return 400 and
oversized payloads return 413. mount/2 does not run on event or stream
POSTs.
All control flow lives here as plain functions — pages contain only callbacks.