GtBridge.Http.SseStream (gt_bridge v0.17.3)

Copy Markdown View Source

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

state()

@type state() :: %{optional(:subscribed) => boolean()}

Functions

info(arg1, req, state)

@spec info(term(), :cowboy_req.req(), state()) ::
  {:ok, :cowboy_req.req(), state(), :hibernate}

init(req, state)

@spec init(:cowboy_req.req(), term()) ::
  {:cowboy_loop, :cowboy_req.req(), state(), :hibernate}

terminate(reason, req, arg3)

@spec terminate(term(), :cowboy_req.req(), state()) :: :ok