title: start a websocket server in php from the first client request
body: <p>I am trying to use websocket for replacing constants ajax request to the server, that updates ajax information.</p>
  
  <p>As far as I know in the client-server scenario I should launch a php websocket server from command line:</p>
  
  <pre><code>php -q myserver.php
  </code></pre>
  
  <p>WHat I am trying to obtain is to lauch the server when I client connects for the first time, and use this server for all the other clients, <strong>without using the command line</strong>:</p>
  
  <pre><code>var socket = new WebSocket("ws://localhost:10000/myserver.php");
  </code></pre>
  
  <p>This command I want to run the server if it is not running and open a connection for this client.</p>
  
  <p>Is this possible?</p>