summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-30 14:46:26 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-30 14:46:26 (GMT)
commitb4165f9269cb71ccb20e9b525c06951e0033ea2b (patch)
treec35e6e0d2fb7f39a70c2f3388426114aa73d441e /test
parent634ccd50a99d1510037cf3f61686e6abebe5a562 (diff)
improved socket.html
Diffstat (limited to 'test')
-rw-r--r--test/socket.html21
1 files changed, 18 insertions, 3 deletions
diff --git a/test/socket.html b/test/socket.html
index d038527..ae13e19 100644
--- a/test/socket.html
+++ b/test/socket.html
@@ -13,6 +13,7 @@
border: 1px solid;
padding: 1em;
font-family: monospace;
+ margin-top: 1em;
}
</style>
<script src="jquery.min.js"></script>
@@ -22,6 +23,10 @@
$('#rawmsg').text("");
this.sock = new WebSocket("ws://localhost:4080/public/socket");
this.sock.onmessage = function (event) {
+ msg = $.parseJSON(event.data)
+ if (msg.TYPE == "ACK") {
+ $('#sessionid').val(msg.ID);
+ }
$('#rawmsg').append(event.data);
}
this.sock_onopen = function() {
@@ -44,19 +49,29 @@
CLEAR_SHOW_CARTS: true,
SOURCE_URI: "fake://10000" };
s = new Session(req);
+ $('#buttonrun').attr('disabled','disabled')
+ $('#buttoncancel').removeAttr('disabled')
}
function cancel() {
s.cancel();
+ $('#buttonrun').removeAttr('disabled')
+ $('#buttoncancel').attr('disabled','disabled')
+ }
+
+ function init() {
+ $('#buttonrun').removeAttr('disabled')
+ $('#buttoncancel').attr('disabled','disabled')
}
</script>
</head>
- <body>
+ <body onload="init()">
<h1>Radio Helsinki Rivendell Importer:</h1>
- <button onclick="run()">start</button>
- <button onclick="cancel()">cancel</button>
+ <button id="buttonrun" onclick="run()">start</button>
+ <button id="buttoncancel" onclick="cancel()">cancel</button>
+ <span></span><input id="sessionid" type="text" size="45" label="ID">
<div id="rawmsg" class="data"></div>
</body>
</html>