summaryrefslogtreecommitdiff
path: root/test/socket.html
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-30 14:21:09 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-30 14:21:09 (GMT)
commit634ccd50a99d1510037cf3f61686e6abebe5a562 (patch)
tree8b355d0135172242bf05dca6eb6f32941c204f0c /test/socket.html
parente9a1f32139ea729d0cd57a99132adc837d62690b (diff)
implemented cancel command
Diffstat (limited to 'test/socket.html')
-rw-r--r--test/socket.html21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/socket.html b/test/socket.html
index e2f7b85..d038527 100644
--- a/test/socket.html
+++ b/test/socket.html
@@ -19,9 +19,10 @@
<script type="text/javascript">
function Session(req) {
this.req = req
+ $('#rawmsg').text("");
this.sock = new WebSocket("ws://localhost:4080/public/socket");
this.sock.onmessage = function (event) {
- $('#rawmsg').text(event.data);
+ $('#rawmsg').append(event.data);
}
this.sock_onopen = function() {
this.req.COMMAND = "new";
@@ -29,25 +30,33 @@
this.sock.send(JSON.stringify(this.req));
}
this.sock.onopen = this.sock_onopen.bind(this);
+ this.cancel = function() {
+ this.sock.send(JSON.stringify({COMMAND: "cancel"}));
+ }
}
var s;
- function init() {
+ function run() {
req = { LOGIN_NAME: "heslinki",
PASSWORD: "12423",
SHOW_ID: 10002,
CLEAR_SHOW_CARTS: true,
- SOURCE_URI: "http://www.tonycuffe.com/mp3/tail%20toddle.mp3" };
+ SOURCE_URI: "fake://10000" };
s = new Session(req);
}
- </script>
+
+ function cancel() {
+ s.cancel();
+ }
+</script>
</head>
- <body onload="init()">
+ <body>
<h1>Radio Helsinki Rivendell Importer:</h1>
+ <button onclick="run()">start</button>
+ <button onclick="cancel()">cancel</button>
<div id="rawmsg" class="data"></div>
-
</body>
</html>