<html>
  <head>
    <script>
      function init() {
        function debug(string) {
          var element = document.getElementById("debug");
          var p = document.createElement("p");
          p.appendChild(document.createTextNode(string));
          element.appendChild(p);
        }

        var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket;
        var ws = new Socket("ws://localhost:8080/foo/bar?hello=world");
        ws.onmessage = function(evt) { debug("Received: " + evt.data); }