summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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>