title: WebSocket server-side script call
body: <p>WebSocket tutorials say that two things are required:</p>
  
  <p>*1. Server-side script should be started:</p>
  
  <blockquote>
    <blockquote>
      <p>php -q path/to/server.php</p>
    </blockquote>
  </blockquote>
  
  <p>*2. Client-side script should open socket connection:</p>
  
  <blockquote>
    <p>var socket = new WebSocket('ws://example.com:12345/server.php');</p>
  </blockquote>
  
  <p>But requesting 'ws://example.com/server.php' will run server script one more time. It will cause running multiple server instances. Or client requests will cause server-side error (socket_bind(...) => already bound).</p>
  
  <p>Can somebody explain this communication model? Thank you.</p>