Server‐sent events implementation - OpenAgentsInc/openagents GitHub Wiki

Users of OpenAgents.com receive streaming notifications from the server via server-sent events.

The streaming will be managed by one component included in a persistent layout.

Child components can register to receive specific events.

<div hx-ext="sse" sse-connect="/stream">
  <p>Demo Event 1:</p>
  <div sse-swap="event1"></div>

  <p>Demo Event 2:</p>
  <div sse-swap="event2"></div>

  <p>Messages Catch-all:</p>
  <div sse-swap="message"></div>
</div>

The /stream endpoint is handled by the ChatController:

Route::get('/stream', [ChatController::class, 'sseStream']);

The sseStream method begins by setting up the stream with the headers and keep-alive:

⚠️ **GitHub.com Fallback** ⚠️