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

An SSE stream can be consumed using Http Fetch Streamed 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

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.

Last updated

Was this helpful?