diff options
Diffstat (limited to 'test/socket.html')
-rw-r--r-- | test/socket.html | 21 |
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> |