diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-29 01:08:23 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-29 01:08:23 (GMT) |
commit | 504bf46904fa807dfa0abceeee717465f8fb3647 (patch) | |
tree | 3a92e30f7a41266d64e35519fad331aa874672da /test/socket.html | |
parent | 6024ae8d84c7486be7f7be3e1091f47d73008222 (diff) |
added basic websockethandler control interface
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> |