title: How to response to all clients with websocket?
body: <p>I'm working on a small project with PHP-Websocket.</p>
  
  <p>The Server side is running with this <a href="https://github.com/ghedipunk/PHP-Websockets" rel="nofollow">https://github.com/ghedipunk/PHP-Websockets</a></p>
  
  <p><strong>Server side:</strong></p>
  
  <pre><code>require "PHP-Websockets/websockets.php";
  
  class Server extends WebSocketServer
  {
      private $_connecting = 'Connecting..';
      private $_welcome = 'SOCKET SERVER!';
  
  
      protected function connected($user)
      {
          // Send welcome message to user when connected
  
      }    
  
  
  
      protected function process($user, $message)
      {
          // data sent from client
          $json = json_decode($message);
  
          //prepare data response to client
          $response = json_encode(array('type'=&gt;'notify', 'message'=&gt;'Client'.$user-&gt;id.' has sent a request.'));
          $this-&gt;send($user, $response);
      }
  
      protected function closed($user)
      {
          // Alert on server
          echo "User $user-&gt;id has closed the connection".PHP_EOL;
      }
  
      public function __destruct()
      {
          echo "Server Closed!".PHP_EOL;
      }
  }
  
  $addr = 'localhost';
  $port = '2207';
  $server = new Server($addr, $port);
  $server-&gt;run();
  </code></pre>
  
  <p><strong>Client Side:</strong></p>
  
  <pre><code>&lt;script&gt;
  var uri = "ws://localhost:2207";
  function socket_connect(){
      socket = new WebSocket(uri);
      if(!socket || socket == undefined) return false;
  
      socket.onopen = function(){
          console.log('Connected to Server!');
      }
  
      socket.onerror = function(){
          console.log('Connection Failed!');
      }
  
      socket.onclose = function(){
          socket_log('Connection Closed! ')
      }
  
      socket.onmessage = function(e){
          //var response_data = e.data;
          var msg = JSON.parse(e.data); //PHP sends Json data to client
          console.log(msg.message);
          var new_response = '&lt;li&gt;'+msg.message+'&lt;/li&gt;;
          $('#response').append(new_response);
      }
  }
  
  function send_data_to_server(data){
      if(!socket || socket == undefined) return false;
      socket.send(JSON.stringify(data));
  }
  
  $(document).ready(function(){
      socket_connect();
  
  
      $('#send_request').click(function(){
          send_data_to_server({message: 'Message sent from Client'});
      });
  });
  &lt;/script&gt;
  
  &lt;input type="button" id="send_request" value="Send Request to Server" /&gt;
  
  &lt;ul id="responses"&gt;&lt;/ul&gt;
  </code></pre>
  
  <p>Everything works fine with those code above. </p>
  
  <p>When Client1 sends a request to Server, the Server responses to him instantly. BUT the other clients can not see the response message.</p>
  
  <p>So I want to make it go further : When a client sends a request to the server, the server will response to <strong>ALL</strong> clients so that all client can see the message.</p>
  
  <p>How can I do that?</p>
  
  <p>Thanks in advance &amp;&amp; sorry for my bad English!</p>