The SSE Server Hub allows for HTTP Client Requests (through a Rest Expose API) to be persisted for Event Streaming as per protocol1. This is accomplished by switching the mime-type response to the appropriate text/event-stream and flushing the messages complying to the event source format2.
The SSE Client implements the Event Source JS Interface containing the Server Sent Event API, also per protocol3.
Effectively, no third parties are required for Server Push/Messaging.
1 https://html.spec.whatwg.org/multipage/server-sent-events.html
2 https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
3 https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
1- Create a new module(service is fine) inside your Application - HelloWorld_Hub.
A single Hub Module should serve a single purpose/application, but any combination is possible, even a single SSE Hub for the entire Outsystems Environment.
2- Open the module dependencies (ctrl+q), search for SSE_IS and add both the "Broadcast" and "OpenStream" server actions.
3- Create a new *Service Action* named "Broadcast2HelloWorld" with a Message Input(text) variable.
Add the imported SSE_IS "Broadcast" to the flow and fill in Message variable, and the Channel - "HelloWorld".
That's it to Broadcast to every client subscribed to a Channel.
4- Create an Exposed Rest API named "SSESubscribe". Add a new GET REST API Method - HelloWorldChannel and add the imported SSE_IS "OpenStream" action.
Fill in the Channel variable with "HelloWorld".
That's it, your Hub is now able to add new Http Clients to the "HelloWorld" channel.
Take note of the Rest's Endpoint URL, e.g: "/HelloWorld_Hub/rest/SSESubscribe/HelloWorldChannel"
5- Install one of the SSE Clients from forge - Reactive / Traditional. In your Client Module (React, Mobile, Traditional), open the module dependencies (ctrl+q), search for the SSE_LIB / SSE_Traditional_Lib and add the EventSource WebBlock to your Screen.
Fill in the SSE URL from above:
"/HelloWorld_Hub/rest/SSESubscribe/HelloWorldChannel".
Also, create the mandatory event handler for the receiving messages.
That's all for the simplest setup! Whenever the "Broadcast" *Service Action* in the HUB is called by any agent, all clients will receive the issued message.
Please try any of the SSE Clients (Reactive / Traditional) to connect to your Hub, and check their example apps.
* create a new module on the application where the SSE is needed
* consume the SSE_IS "Broadcast" and "OpenStream" actions
* wrap and expose the Broadcast via a Service Action with the appropriate auth if applicable
* expose a new rest endpoint for the OpenStream action with the appropriate auth if applicable
This will be responsible to add new client http connections to the hub
It is recommended that a single Hub Module serves a single purpose/application, but any combination is possible, even a single SSE Hub for the entire Outsystems Environment.
*(There is no particular order for the above)
5- In your Client Module (React, Mobile) open the module dependencies (ctrl+q), search for the SSE_LIB and add the SSEEventListener WebBlock to your Screen.