genskel: Add option for C++ output
[src/app-framework-binder.git] / test / AFB.html
1 <html>
2 <head>
3     <title>Test of AFB Echo</title>
4     <script type="text/javascript" src="AFB.js"></script>
5     <script type="text/javascript">
6         var afb = new AFB("api", "hello");
7         var ws;
8
9         function onopen() {
10                 document.getElementById("main").style.visibility = "visible";
11                 document.getElementById("connected").innerHTML = "Connected to WebSocket server";
12                 ws.onevent("*", gotevent);
13         }
14         function onabort() {
15                 document.getElementById("main").style.visibility = "hidden";
16                 document.getElementById("connected").innerHTML = "Connected Closed";
17         }
18         function init() {
19                 ws = new afb.ws(onopen, onabort);
20         }
21         function replyok(obj) {
22                 document.getElementById("output").innerHTML = "OK: "+JSON.stringify(obj);
23         }
24         function replyerr(obj) {
25                 document.getElementById("output").innerHTML = "ERROR: "+JSON.stringify(obj);
26         }
27         function gotevent(obj) {
28                 document.getElementById("outevt").innerHTML = JSON.stringify(obj);
29         }
30         function send(message) {
31                 var api = document.getElementById("api").value;
32                 var verb = document.getElementById("verb").value;
33                 ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr);
34         }
35     </script>
36
37 <body onload="init();">
38     <h1>WebSocket Echo</h1>
39     <div id="connected">Not Connected</div>
40     <div id="main" style="visibility:hidden">
41     API: <input type="text" id="api" value="hello" size="80"/><br/>
42     VERB: <input type="text" id="verb" value="ping" size="80"/><br/>
43     Enter Message: <input type="text" name="message" value="" size="80" onchange="send(this.value)"/><br/>
44     Server says... <div id="output"></div>
45     Events: <div id="outevt"></div>
46     </div>
47