diff options
Diffstat (limited to 'test/socket.html')
-rw-r--r-- | test/socket.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/socket.html b/test/socket.html new file mode 100644 index 0000000..d110c81 --- /dev/null +++ b/test/socket.html @@ -0,0 +1,46 @@ +<html> + <head> + <title>rhimportd - Testclient</title> + <style type="text/css"> + body { + background-color: #555; + } + + div.data { + background-color: white; + border: 1px solid; + padding: 1em; + font-family: monospace; + } + </style> + <script src="jquery.min.js"></script> + <script type="text/javascript"> + function Test() { + this.sock = new WebSocket("ws://localhost:4080/trusted/socket"); + this.sock.onmessage = function (event) { + $('#rawmsg').text(event.data); + } + this.seqnum = 0; + this.update = function() { + if ((this.seqnum % 15) == 0) { + this.sock.send(JSON.stringify({ test: "hello world", seq: this.seqnum })); + } + this.seqnum += 1; + } + } + + function init() { + test = new Test(); + setInterval(test.update.bind(test), 1000); + // test.update(); + } + </script> + </head> + <body onload="init()"> + + <h1>Radio Helsinki Rivendell Importer:</h1> + + <div id="rawmsg" class="data"></div> + + </body> +</html> |