SSE - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki

<SSE/> : DataSource

The SSE opens a connection between the application and an API that receives server side events notifications asynchronously.

Restrictions:

  • A SSE is intended for one way communication, if you need bi-directional consider a WebSocket or a HTTP method for sending from client to server such as GET / POST datasources.

Parent:

Datasources

Attributes

Name Type Default Description Req
id string null The id of the widget used for databinding.
url string null The url that opens the server side event connection.
events string "message" A comma seperated string specifying the valid event types to trap.
autoexecute bool true If the widget will fire when the template is first opened or on url change
tti int(s,m,h) 5s The time the Datasources status will stay as anything but idle.
onsuccess string/Event null The string of events the broker will execute upon a successful query.
onfail string/Event null The string of events the broker will execute upon a failed query.

Attributes (Data Specific)

Name Type Default Description Req
data List of item where item is a Map<String, String> or another List of item If the response is encoded as valid json or xml it is deserialized and addressable using DOTNOTATION
queueType string replace replace, lifo, fifo, append, prepend. Defines the data aggregation strategy for data returned from initial and subsequent calls. replace (default) replaces all data after each subsequent call. lifo (last in first out), fifo (first in first out), append and prepend are all used in conjunction with the maxrecords attribute
maxrecords int 10000 The maximum size data can grow to. This works in concert with type
root string The root tag that defines the repeatable items in data. This can be a nested field. If not specified, the list is segmented by the first repeatable element found in the data set
ttl int(s,m,h) 0s Time to Live caches data in the local persistent HIVE database for the period specified. This saves requerying data that changes infrequently
rowcount int 0 The number of records in data

Methods (Data Specific)

Name Type Description
clear() Clears data. Invoked in any EVENT string using <id>.clear()
add(jsonOrXml, index) string, int Deserializes the jsonOrXml string and adds it to the end of data or at position index if specified. Invoked in any EVENT string using <id>.add(jsonOrXml, index)
remove(index) int Removes the last item from data or from position index if specified. Invoked in any EVENT string using <id>.remove(index)
reverse() Reverses data. Invoked in any EVENT string using <id>.reverse()

Events

Name Type Description
start() Establishes a connection to the server. Invoked in any EVENT string using <id>.start()
connect() Establishes a connection to the server. Invoked in any EVENT string using <id>.connect()
stop() Closes the connection. Invoked in any EVENT string using <id>.stop()
disconnect() Closes the connection. Invoked in any EVENT string using <id>.disconnect()

Properties

Name Type Default Description Req
rowcount int 0 The number of records in the data bindable
status string idle The status of the broker, returns error, success or idle.
statusmessage string null Returns a status message (usually from the response on an exception ).
statuscode string null Returns the http status code.
httpstatus string null Returns the generic message associated with the http status code.

Headers

The default HTTP headers are as follows:

  • age = '0';
  • content-encoding= 'utf8';
  • content-type = "application/xml";
  • authorization = JWT TOKEN

If the <HEADERS> element is specified, the defaults headers are omitted and replaced with those specified.

Example #1

This example demonstrates how to omit all headers.

<HEADERS/>

Examples

(fig. a)
<SSE id="sse1" autoexecute="true" url="https://sse.dev/test" messagetypes="put,post,message"/>
<TEXT label="=todate({sse1.data.now})"/>

logo See it in Action

Other Widgets You May Find Useful

⚠️ **GitHub.com Fallback** ⚠️