title: Wait for specific packet after connection establishment in local socket
body: <p>I'm currently working on a C++ application that communicates with my browser using WebSockets. The connection is only local, there won't ever be any non-local socket. </p>
  
  <p>Currently my C++ code looks like that (just for an example):</p>
  
  <pre><code>while (true) {
      WebSocket *socket = server-&gt;accept () ;
      socket-&gt;read (buffer, 256) ;
  }
  </code></pre>
  
  <p>And my javascript code:</p>
  
  <pre><code>var socket = new WebSocket ("ws://localhost:4564") ;
  socket.onopen = function () {
      socket.send("Hello my name is Holt!");
  } ;
  </code></pre>
  
  <p>As you can see, I'm waiting for a packet that should be sent as soon as the connection is openned. So I got 2 questions:</p>
  
  <ul>
  <li>First, are there any way to send this information directly inside the connection? (I think no, so it's why my second question comes for...)?</li>
  <li>Second, knowing that the connection is local, is that possible that the server accept the socket without being able to retrieve the packet after?</li>
  </ul>
  
  <p>To add a bit more information, the current C++ application is based on Qt 5.3 with the QtWebSockets module and the javascript code is  a Google Chrome extension that will run a script on specific websites.</p>
  
  <p>Thanks for you help!</p>