diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-04-20 16:51:42 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-04-20 16:51:42 +0200 |
commit | 94ad734842c1359a012f9850b851063637d3e061 (patch) | |
tree | e962852735e0f0b7d492466068b4ea66a96e4cc4 /test/AFB.html | |
parent | ec24258a5e9d39b5fd1d4f127d2d335a853e0fe5 (diff) |
javascript reference with promise and event
Change-Id: I77633c0be2338ce4d03f84884462836604d932c8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'test/AFB.html')
-rw-r--r-- | test/AFB.html | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/AFB.html b/test/AFB.html index 344eb158..a1a4bf59 100644 --- a/test/AFB.html +++ b/test/AFB.html @@ -9,6 +9,7 @@ function onopen() { document.getElementById("main").style.visibility = "visible"; document.getElementById("connected").innerHTML = "Connected to WebSocket server"; + ws.onevent("*", gotevent); } function onabort() { document.getElementById("main").style.visibility = "hidden"; @@ -23,10 +24,13 @@ function replyerr(obj) { document.getElementById("output").innerHTML = "ERROR: "+JSON.stringify(obj); } + function gotevent(obj) { + document.getElementById("outevt").innerHTML = JSON.stringify(obj); + } function send(message) { var api = document.getElementById("api").value; var verb = document.getElementById("verb").value; - ws.call(api, verb, {data:message}, replyok, replyerr); + ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr); } </script> @@ -38,5 +42,6 @@ VERB: <input type="text" id="verb" value="ping" size="80"/><br/> Enter Message: <input type="text" name="message" value="" size="80" onchange="send(this.value)"/><br/> Server says... <div id="output"></div> + Events: <div id="outevt"></div> </div> |