4 <script type="text/javascript">
6 var wsuri = "ws://dev.myslice.info:9000";
8 window.onload = function() {
10 sock = new WebSocket(wsuri);
12 sock.onopen = function() {
13 console.log("connected to " + wsuri);
16 sock.onclose = function(e) {
17 console.log("connection closed (" + e.code + ")");
20 sock.onmessage = function(e) {
21 console.log("message received: " + e.data);
26 var msg = document.getElementById('message').value;
32 <h1>WebSocket Echo Test</h1>
36 <input id="message" type="text" value="Hello, world!">
39 <button onclick='send();'>Send Message</button>