title: open websocket connection firefox addon
body: <p>Is it possible for a firefox addon to establish a websocket connections?</p>
  
  <p>When I try: </p>
  
  <pre class="lang-js prettyprint-override"><code>var wsUri = "ws://echo.websocket.org/";
  var ws = gBrowser.contentWindow.window.WebSocket ||
           gBrowser.contentWindow.window.MozWebSocket;    
  var websocket = new ws(wsUri);
  </code></pre>
  
  <p>In the Error Console the message says</p>
  
  <blockquote>
    <p>Error: Firefox can't establish a connection to the server at ws://echo.websocket.org/.</p>
  </blockquote>