Created on 02 September 2022
icon_unfollowing
Login to follow
sse-reactive-client

SSE Reactive Client

Stable version 1.0.4 (Compatible with OutSystems 11)
Uploaded on 30 May 2023 by 
sse-reactive-client

SSE Reactive Client

Documentation
1.0.4

Detailed description

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


Related Components


Notes

  • SSE are not web-sockets (they are a one way channel from server to client), nor polling mechanisms (it is an HTTP protocol implementation). 
  • This is a work in progress, any help/suggestions are welcomed. Please read the Examples Sections on the Module, and have a look around :)


Current Issues

  • Scaling the Module of the Hub is not possible out of the box. This means that multiple front-end servers will spawn multiple Hub instances which this component does not directly support. There is however an alternative that you can check in the Example App included in this module, and its high level diagram view at the end of these docs. As an alternative, a dedicated non-scalable zone is needed. 
  • IOS native apps are currently not supported. I am working on understanding how to make this work
  • The hub currently logs a "Slow Extension" log on Service Center when a client disconnects. The reason is that the Hub needs to check the client connections to keep them alive and this is "seen" as a slow extension method. There might be a way to suppress these logs at the Service Center, but I currently don't know how. 
  • Background Notifications on both Mobile and PWA are not supported. If this is a deal breaker, please use Apple's APN/ Google's FCM approaches (Firebase, OneSignal, etc...) There is now the possibility to address this in PWA apps using Microsoft's Fetch Event Source but it has not been tested/worked on.
  • On Personal Environments(PE), there seems to be a cap of 100 concurrent API live connections per Hub Module. 


SSE_Lib - Event Listener

EventSource / MSFTFetchEventSource
- This block listens to a specific HUB Channel
- It is possible to further filter the Channel by its events
- A Token GUID is issued every time a new connection is established and it uniquely identifies the connection
- The block is initiated when the SSESubscribeURL is populated. Please refer to further examples @ the examples app
- Authentication can be implemented by passing a token together with the URL as a parameter, and validating it either on the onRequest hook or with the custom onAuthentication hook, using SSL if using native EventSource.
You can also use Microsoft's FetchEventSource block that allows custom headers to be passed instead of the native approach.
Please refer to further examples @ the examples app
- The SSE EventStream interface ensures resilience through an auto-connect on disconnect, so everything is handled in case of disconnection. Have in mind though, that the same URL will be used.


Examples

An example Chat App is included in this component for a functional chat.

For further details, documentation and examples, please check the Related Components.


1.0.3

Detailed description

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


Related Components


Notes

  • SSE are not web-sockets (they are a one way channel from server to client), nor polling mechanisms (it is an HTTP protocol implementation). 
  • This is a work in progress, any help/suggestions are welcomed. Please read the Examples Sections on the Module, and have a look around :)


SSE_Lib - Event Listener

EventSource / MSFTFetchEventSource
- This block listens to a specific HUB Channel
- It is possible to further filter the Channel by its events
- A Token GUID is issued every time a new connection is established and it uniquely identifies the connection
- The block is initiated when the SSESubscribeURL is populated. Please refer to further examples @ the examples app
- Authentication can be implemented by passing a token together with the URL as a parameter, and validating it either on the onRequest hook or with the custom onAuthentication hook, using SSL if using native EventSource.
You can also use Microsoft's FetchEventSource block that allows custom headers to be passed instead of the native approach.
Please refer to further examples @ the examples app
- The SSE EventStream interface ensures resilience through an auto-connect on disconnect, so everything is handled in case of disconnection. Have in mind though, that the same URL will be used.


Examples

An example Chat App is included in this component for a functional chat.

For further details, documentation and examples, please check the Related Components.


Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
SSE Reactive Client has no dependencies.