title: JavaScript and WebSockets: using specific protocol
body: <p>I'm currently working with WebSockets and a PHP server: it works very well with Google Chrome and Opera, but not with Firefox 6.</p>
  
  <p>I think it's due to the protocol version this last uses: I see somewhere that it uses the seventh version, whereas it's an older one for Google Chrome and Opera.</p>
  
  <p>So, I modified my server code in order to manage this new version: by hashing the secure-key with <em>258EAFA5-E914-47DA-95CA-C5AB0DC85B11</em> and other stuffs, Firefox succeeds to connect.
  But if another client wants to connect (even another Firefox), the first one with Firefox deconnects itself.</p>
  
  <p>I saw that buffer received by socket_recv() is either empty or hashed...</p>
  
  <p>So I decided to skip the idea of managing the protocol used by Firefox 6 (there are no documentation on Internet... !): I think it could be easier to specify the protocol to use directly in JavaScript.</p>
  
  <p>On <a href="https://developer.mozilla.org/en/WebSockets/Writing_WebSocket_client_applications" rel="noreferrer">this page</a> they say that we can write this:</p>
  
  <pre><code>var mySocket = new WebSocket("http://www.example.com/socketserver", "my-custom-protocol");
  </code></pre>
  
  <p>But what should we write instead of <em>"my-custom-protocol"</em> in order to use the protocol managed by Google Chrome and Opera?</p>
  
  <p>Thanks in advance!</p>