This topic illustrates different ways to format your real-time data to serve any control or service that is real-time enabled.
<html> <body> Total count of all enable service invocations = <% _ecount(enable.calls) %> <br/> Random <% _random(100) %> <br/> _IF(yes or _IF(true,_IF(true),_IF(no)) and 0) = <% _IF(yes or _IF(true,_IF(true),_IF(no)) and 0) %> </body> </html>
asis:_resource(_sreg(iway.home)index.html)
Notice the prefix in the preceding code:
asis:
When constructing a feed, you must add that prefix to preserve the string that is returned.
The output will be similar to the following.
Total count of all enable service invocations = 181 Random 41 _IF(yes or _IF(true,_IF(true),_IF(no)) and 0) = false
<?xml version="1.0" ?> <rss version="2.0"> <channel> <title>Enable Feeds powered by iSM <%=iwayversion%></title> <description>This RSS feed lists the feeds in Enable available for subscription.</description> <link><%=host-context %>/ism/enable-dat?configuration=<%=iwayconfig%></link> <item> <title>enable-calls Feed</title> <description>A feed which returns the total count of all invocations of enable services. Current count: <% _ecount(enable.calls) %> </description> <link><%=host-context %>/ism/enable-dat?regs=enable-calls</link> </item> <item> <title>value Feed</title> <description>Current random value is <% _random(100) %></description> <link><%=host-context %>/ism/enable-dat?regs=value</link> </item> </channel> </rss>
asis:_resource(_sreg(iway.home)index.rss)
Notice the prefix in the preceding code:
asis:
When constructing a feed, you must add that prefix to preserve the string that is returned.
The browser will ask if you want to subscribe to the feed. If you choose to subscribe, you will see the feed that you created in the list of subscribed feeds in the browser.
You can deserialize the following code using eval() in your JavaScript.
{ "iwayversion"="<%=iwayversion%>", "hostcontext"="<%=host-context %>", "enablecalls"="<% _ecount(enable.calls) %>" }
You can pass the following code to eval() to call a local function named callback. The function callback passes the serialized value of the JSON object.
callback({ "iwayversion"="<%=iwayversion%>", "hostcontext"="<%=host-context %>", "enablecalls"="<% _ecount(enable.calls) %>" } )
You can create your own Web API and import the JavaScript file into an HTML page.
Formatting the feed is as simple as populating a template of your feed with iWay Server Page (iSP) contexts that contain iWay Functional Language (iFL) functions.
var myenable = { "iwayversion"="<%=iwayversion%>", "hostcontext"="<%=host-context %>", "enablecalls"="<% _ecount(enable.calls) %>" } function getMyEnableInfo() { return myenable; }
iWay Software |