# Server Sent Events (SSE)

SSE create a lightweight, uni-directional connection from your server to a client's web browser. They are often easier to manage than WebSockets, and are built on top ofHTTP connections (making them less likely to be blocked by firewalls).

As of version 1.7, SSE support has been moved into a new extension, and the existing hx-sse tag has been deprecated. All future development will occur in the extension code, and the deprecated tag will be removed in htmx version 2.0

### Required Attributes

hx-ext | Make sure the SSE extension is initialized on every page or page fragment where you use SSE streams.
sse-connect | Connects to a SSE event stream
sse-swap | Specifies the messages that a particular DOM element will listen to.

### Example Code

    <body hx-ext="sse">
    <div sse-connect="https://my.sse.server.com" sse-swap="message"></div>
    </body>

### SSE Resources

- Wikipedia
- MDN Web Docs
- Can I Use?