52
Views
1
Comments
How to handle text/event-stream Response from API
Application Type
Reactive
Service Studio Version
11.54.46 (Build 63163)

How does OutSystems handle response of format text/event-stream?

I believe the ordinary rest API does not have an option in response format for text/event-stream. But, my external api returns response in that format. Additionally, I would like to maintain 1 single connection (not periodically polling), and keep updating the UI while data is streamed.

What OutSystems tools can I use to achieve my target? Is there any common practice or logic implemented in OutSystems to handle such situation?

2025-12-09 14-11-18
Janakiraman JR

Hi,

OutSystems does not natively support text/event-stream (SSE - Server-Sent Events) in its REST integrations. The built-in REST API logic expects standard, discrete HTTP responses (like JSON, XML, plain text, etc.), and does not provide a way to maintain a long-lived, open connection for streaming data. That said, there are alternative patterns and tools you can use to handle SSE-like functionality in OutSystems. 

Try Using below approach,

OutSystems Web and Reactive apps allow embedding JavaScript, which can handle SSE natively via the browser’s EventSource API.

  1. Create a Web Block (e.g., SSEHandler) that:

    • Accepts the API URL as an input.

    • Injects JavaScript using EventSource.

    • Updates the UI using OutSystems triggerEvent or JavaScript-to-Client actions.

  2. JavaScript snippet inside Web Block:

    var source = new EventSource($parameters.StreamUrl);

    source.onmessage = function(event) {

      // Parse and send to OutSystems logic

      $actions.OnMessageReceived(JSON.parse(event.data));

    };

  3. Define a Client Action OnMessageReceived in the Web Block to process and update the UI.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.