<html> <head> <title>hello websocket world</title> <script> window.onload = function() { var ws = new WebSocket('ws://localhost:54321'); var pre = document.getElementsByTagName('pre')[0]; var log = function(str) { pre.innerHTML += str + '<br>'; }; ws.onopen = function() { ws.send('hello world world world world world world world world world world world world world world world world world world world world world world'); }; ws.onmessage = function(e) { log('rcvd ' + e.data); ws.close(); }; ws.onclose = function() { log('imma closing'); }; }; </script> </head> <body> <h1>gogo websockets!</h1> <pre></pre> </body> </html>