> For the complete documentation index, see [llms.txt](https://docs.midio.com/midio-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.midio.com/midio-docs/guides/http/server-sent-events-sse.md).

# Server-Sent Events (SSE)

Server-Sent Events (SSE) is a protocol for sending real-time updates from a server to a client over a single HTTP connection. Your flows can both consume SSE streams (using `Http Fetch Streamed` and expose SSE endpoints to send events to connected clients (using various functions in the `Http Server-Sent Events` module).

## Consuming SSE Endpoints

<figure><img src="/files/HgAEO7ox6w6Q2e5c18aN" alt=""><figcaption></figcaption></figure>

An SSE stream can be consumed using [`Http Fetch Streamed`](/midio-docs/built-in-nodes/http.md#fetchstreamed) to initiate a request, and then `Parse SSE Stream` to extract messages one at a time as they arrive. Notice that after handling each event, we loop back to the `Parse SSE Stream` function, which then lets us handle the next message. When the `stream closed` trigger fires, we don't loop back but just print a message to the log.

## Serving SSE Endpoints

<figure><img src="/files/g8s7InfZWGNgE5lvZ7xP" alt=""><figcaption></figcaption></figure>

You can respond with an SSE stream from your own endpoints by first calling `Start SSE Response`, and then call `Send SSE Event` as many times as you like with the data you want to transmit. The example above sends each word in the string one at a time.
