Data

Overview

<translate url="/lib/translate/v1.0.0/data.mjs"></translate>

Embedded Data

Embedded data is data that is specified within the data tags, which are then made available to the rest of the page.

<data name="category"> <script type="json"> [{"category":"hawaii","subcategory":"oahu","value":80},{"category":"hawaii","subcategory":"big island","value":10},{"category":"hawaii","subcategory":"kauai","value":15},{"category":"california","subcategory":"san francisco","value":100},{"category":"california","subcategory":"los angeles","value":200},{"category":"california","subcategory":"san jose","value":70}] </script> </data>

Web Data

Web data is data that is retrieved from some URL on the web.

<web-data name="category" url="/server.com/data.json" frequency="5000"> </web-data>

You can specify additional parameters by including them in a json/script tag within the web-data tag. This can include:

  • type - you can specify the type of HTTP request, e.g. "GET", "POST" You specify the post parameters by including a data object. (Note, if a data object is present, then the type defaults to "POST")
  • Headers - any headers


<web-data name="category" url="/server.com/data.json"> <script type="json"> { headers:{'header1':'value1'}, data:{'param1':'value2'} } </script> </data>

Websocket (Real Time) Data



<websocket-data url="ws://localhost:8080/" name="real prices"> </websocket-data>
<websocket-data url="ws://localhost:8080/" name="real prices"> <script type="json"> { params1:'value1', params2:'value2' } </script> </websocket-data>
sample server