ServerEvents

Qubes 9.0 Server Events component.

Properties

PropertyDescription
EnabledBoolean indicating whether or not the component is enabled.
FormatFormat of event data evaluation (data by default).
HintSpecifies the user hint string that will appear in the component's interactive help bubble.
URLURL of the events source.
ValueInitialDetermines the component's initial value when the screen opens and each time it is reset (see Reset Button).
VisibleBoolean indicating whether or not the component will be visible.

Value

This component provides access to Server-Sent Events, it connects to an Events Source, and its value is the last event from the source.

Remarks

Server-Sent Events can be used to push a stream of data or notifications from a server.
In QubesExpress the WebServerSentEvents class can be used to manage multiple events sources, and broadcast events to subscribers.
The pushed messages should be of type "message" to be recognized.

The browser will automatically attempt to reconnect to a source in case the connection is lost.

The Format property allows adjusting the level of detail of the event, the options are:

  • data : the value of the component is just the data field of the event
  • json : the value of the component is a json with all the fields of the event

Note: When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low number (6). The issue has been marked as "Won't fix" in Chrome and Firefox. This limit is per browser + domain, so that means that you can open 6 SSE connections across all of the tabs to www.example1.com and another 6 SSE connections to www.example2.com. (from Stackoverflow). When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100).

Component is available on versions above 9.2021.701

See also server-side script example on ScrWiki.

Classification

Cloud