Plug for handling PhoenixDatastar requests.
Handles SSE streams and event dispatch:
- GET /path/stream - Maintains SSE connection for server-pushed updates (live views)
- POST /path/_event/:event - Handles events for all views
Summary
Functions
@spec call( Plug.Conn.t(), keyword() ) :: Plug.Conn.t()
Handles incoming requests for Datastar views.
Dispatches based on HTTP method:
- GET: SSE stream connection
- POST: Event dispatch to GenServer
Initializes the plug with options.
Options
:view- The view module to handle requests. Required for SSE streams, optional for the global event endpoint.