Request handler for the realtime events endpoint (GET /<events_path>).
Bridges Postgres NOTIFY to Server-Sent Events: authenticates with the
instance's standard JWT gate FIRST (a tokenless request on a JWT-protected
instance is 401 regardless of channel validity — this prevents an
unauthenticated channel-enumeration oracle), then validates the requested
channels against the events_channels allowlist, then holds the
connection open inside the Bandit connection process, relaying
{:bier_event, channel, payload} messages from Bier.Events.Listener as
SSE frames.
Delivery is fire-and-forget (at-most-once): NOTIFY is ephemeral, so events
fired while a client is disconnected are lost. Clients get a retry: hint
and periodic keepalive comments; reconnection does not replay.
Summary
Functions
Handle a subscription request. Returns the streaming Plug.Conn (which
only comes back once the client disconnects) or an {:error, reason} for
Bier.Plugs.FallbackController.
True when this request targets the events endpoint: the feature is enabled (non-empty allowlist) and the path is exactly the configured segment.
Functions
@spec handle(Plug.Conn.t(), Bier.Config.t()) :: Plug.Conn.t() | {:error, term()}
Handle a subscription request. Returns the streaming Plug.Conn (which
only comes back once the client disconnects) or an {:error, reason} for
Bier.Plugs.FallbackController.
@spec handles?(Plug.Conn.t(), Bier.Config.t()) :: boolean()
True when this request targets the events endpoint: the feature is enabled (non-empty allowlist) and the path is exactly the configured segment.