title: WebWorkers and WebSockets with Firefox
body: <p>I'm trying to implement a working WebSocket connection within a WebWorker. That should be simple and it is if I use Chrome as b rowser. However, since this experiment should further become part of a production I need it to work on all the great Browsers, namely also Firefox.</p>
  
  <p>My problem is that I can't get it working with Firefox. At first Firefox wasn't able to create a WebWorker. That was a Bug and is fixed with version 9. But now it seems that it wouldn't be able to create a WebSocket within the Worker.</p>
  
  <p>I tried the following line of code:</p>
  
  <pre><code>var ws = new WebSocket(url);
  </code></pre>
  
  <p>which fails with:</p>
  
  <pre><code>WebSocket is not defined
  </code></pre>
  
  <p>Well, according to <a href="https://developer.mozilla.org/en/WebSockets/Writing_WebSocket_client_applications">this</a> it should work. But it doesn't, neither within the WebWorker nor outside of this context. I tried the older </p>
  
  <pre><code>var ws = new MozWebSocket(url);
  </code></pre>
  
  <p>which seems to work outside of the WebWorker but I get the same error as above within it.</p>
  
  <p>Now, what's the problem? I know WebSockets where disabled byy default in some older versions but version 9 should support a similar functionality as Chrome (at least that's what they say on their side). So am I doing something wrong?</p>
  
  <p>Im using Ubuntu 11.10 and did not test other browsers yet.</p>
  
  <p>Thanks in advance!</p>