| 123456789101112131415161718192021222324252627282930313233343536 |
- <!doctype html>
- <html>
- <head>
- <title>twspy echo test client</title>
- </head>
- <body>
- <textarea id="log" rows="20" cols="80" readonly="readonly"></textarea>
- <script type="text/javascript">
- function log(line) {
- document.getElementById('log').innerHTML += line + '\n';
- }
- var URL = 'localhost:8000';
- log('Connecting to ' + URL);
- var ws = new WebSocket('ws://' + URL);
- ws.onopen = function() {
- log('Connection complete, sending "foo"');
- ws.send('foo');
- };
- ws.onmessage = function(msg) {
- log('Received "' + msg + '", closing connection');
- ws.close();
- };
- ws.onerror = function(e) {
- log('Error', e);
- };
- ws.onclose = function() {
- log('Connection closed');
- };
- </script>
- </body>
- </html>
|