title: Multiple Websockets
body: <p>I'm trying to use two websockets on one page.  This is my code:</p>
  
  <pre><code>var pageViewWs = new WebSocket("ws://localhost:9002/pageView");
  var sessionWs = new WebSocket("ws://localhost:9002/session");
  
  pageViewWs.onmessage = function (event) {
    alert("PageView");
  };
  
  sessionWs.onmessage = function (event) {
    alert("Session"); 
  };
  </code></pre>
  
  <p>Only the PageView alert appears.  On the server side no requests are made to /session, only to /pageView.</p>
  
  <p>Now, if I switch var pageViewWs and var sessionWs around then the Session alert is shown instead of the PageView.  It is not because they are alerts, I've tried appending to the body and to divs and I've stepped through using Firebug.  It seems that only one WebSocket can be created at a time although in Firebug the properties for pageViewWs and sessionWs appear the same with the exception of their url.</p>
  
  <p>I've only tested this in Firefox 15.0.1.  Is there some sort of Websocket limitation whereby you can only run one at a time?  Or is something wrong with my code?</p>