summaryrefslogtreecommitdiff
path: root/test/socket.html
diff options
context:
space:
mode:
Diffstat (limited to 'test/socket.html')
-rw-r--r--test/socket.html17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/socket.html b/test/socket.html
index 7c3a149..ab631ac 100644
--- a/test/socket.html
+++ b/test/socket.html
@@ -23,7 +23,7 @@
$('#rawmsg').text("");
this.sock = new WebSocket("ws://localhost:4080/public/socket");
this.sock.onmessage = function (event) {
- $('#rawmsg').append(event.data);
+ $('#rawmsg').append(event.data + "\n");
msg = $.parseJSON(event.data)
switch (msg.TYPE) {
case "ACK":
@@ -31,19 +31,26 @@
$('#buttonrun').attr('disabled','disabled')
$('#buttonreconnect').attr('disabled','disabled')
$('#buttoncancel').removeAttr('disabled')
+ $('#buttonlist').removeAttr('disabled')
break;
case "DONE":
init();
break;
}
}
+
this.sock_onopen = function() {
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"}));
}
+
+ this.list = function() {
+ this.sock.send(JSON.stringify({COMMAND: "list", LOGIN_NAME: "heslinki", PASSWORD: "12423"}));
+ }
}
var s;
@@ -71,11 +78,16 @@
s.cancel();
}
+ function list() {
+ s.list();
+ }
+
function init() {
$('#sessionid').val("");
$('#buttonrun').removeAttr('disabled')
$('#buttonreconnect').removeAttr('disabled')
$('#buttoncancel').attr('disabled','disabled')
+ $('#buttonlist').attr('disabled','disabled')
}
</script>
</head>
@@ -84,9 +96,10 @@
<h1>Radio Helsinki Rivendell Importer:</h1>
<button id="buttonrun" onclick="run()">start</button>
- <button id="buttoncancel" onclick="cancel()">cancel</button>
<input id="sessionid" type="text" size="45" label="ID">
<button id="buttonreconnect" onclick="reconnect()">reconnect</button>
+ <button id="buttoncancel" onclick="cancel()">cancel</button>
+ <button id="buttonlist" onclick="list()">list</button>
<div id="rawmsg" class="data"></div>
</body>
</html>