View Source Buckaroo.EventSource behaviour (buckaroo v0.4.2)
A simple SSE implementation.
Link to this section Summary
Link to this section Types
@type event() :: %{ :data => binary(), optional(:id) => binary(), optional(:type) => binary(), optional(:retry) => pos_integer() } | binary()
SSE event.
@type result(state) :: {:ok, state} | {:ok, state, :hibernate} | {:reply, event() | [event()], state} | {:reply, event() | [event()], state, :hibernate} | {:stop, state}
SSE callback result.
Link to this section Callbacks
Incoming process messages.
@callback init(conn :: Plug.Conn.t(), state :: state) :: result(state) when state: any()
Initialize the SSE.
Passes the connection and the given state.
SSE termination.