| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | <!DOCTYPE html><meta charset="utf-8" /><html><head>    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>    <script language="javascript" type="text/javascript">        $(function() {            var connection = null;            $('#join').click(function() {                if (connection != null) {                    connection.close();                    connection = null;                }                var uri = 'ws://' + window.location.host + '/ws/';                connection = new WebSocket(uri);                                var game_id = $('#gameId').val();                var nick = $('#nick').val();                connection.onopen = function() {                    var msg = {                        join: {                            game_id: game_id,                            nick: nick,                        }                    };                    connection.send(JSON.stringify(msg));                };                connection.onmessage = function(e) {                    alert('Received: ' + e.data);                };                connection.onclose = function() {                    //alert("closing");                    connection = null;                };            });        });    </script></head><body><form id="loginform">  <label for="gameId">Game ID:</label>  <input id="gameId" type="text"  /><br>  <label for="nick">Nickname:</label>  <input id="nick" type="text" /><br>  <input id="join" type="button" value="Join" /></form></body></html>
 |