I am the cowboy_loop handler for the /EVENTS SSE channel.
Cowboy's loop handlers are invoked per-message: between events the
process sits in :cowboy_loop_h:loop/1 (Cowboy's own code), not in
user-defined frames. So bridge module recompiles don't keep this
module on a long-lived stack and don't kill the streaming process.
The previous Plug-based implementation died on every-other save
because of BEAM's two-version code purge cycle.
Summary
Types
@type state() :: %{optional(:subscribed) => boolean()}
Functions
@spec info(term(), :cowboy_req.req(), state()) :: {:ok, :cowboy_req.req(), state(), :hibernate}
@spec init(:cowboy_req.req(), term()) :: {:cowboy_loop, :cowboy_req.req(), state(), :hibernate}
@spec terminate(term(), :cowboy_req.req(), state()) :: :ok