Skip to content

Server-sent events (SSE) ​

HTTP messages have a well-defined structure, with headers and a body.

The thing is: whilst an end of body marker is not received, the receiving party can consider that the message is still being received. This can be used for endless and continuous transmission of data. Some technologies that make usage of this are WebSockets, Comet and streaming, like Server-sent events and NDJSON (newline-delimited JSON).

Real-life scenarios ​

Endless streamed responses, like SSE, are useful for applications like real-time monitoring of industrial machinery, tracking geographic coordinates of vehicles, and changes of stock tickers.

SSE is unidirectional, from server to client. For real-time bidirectional comunication, WebSockets are probably the most adequate solution.

Making SSE requests on Pororoca ​

SSE requests are just like any other HTTP request. On Pororoca, just click on New HTTP request and configure it as needed.

When sending the request, if the response contains a Content-Type with the value text/event-stream, application/x-ndjson or application/jsonl, the response body will start to receive the stream and will show it on the screen.

SSE requests on repeaters ​

Repeaters wait for the whole response body to be received, on each request. It's not possible to visualize received events on a repeater until the response ends.