htmx/www/attributes/hx-sse-src.md
2020-05-17 05:22:19 -07:00

662 B

layout title
layout.njk </> htmx - hx-sse-src

hx-sse-src

The hx-sse-src attribute establishes a Server Sent Event EventSource, allowing children of the element to register for server sent event triggers.

  <div hx-sse-src="/event_stream">
    <div hx-get="/chatroom" hx-trigger="sse:chatter">
      ...
    </div>
  </div>

This example establishes an SSE connection to the event_stream end point which then triggers a GET to the /chatroom url whenever the chatter event is seen.

Notes

  • hx-sse-src is not inherited