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?
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.
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.
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));
};
Define a Client Action OnMessageReceived in the Web Block to process and update the UI.