title: How can I send a message to a specific client connected through socket
body: <p>Hello This is my first time working on sockets. I have multiple clients which connect to my socket server through a specific port. I want to send a specific message to a specific client. how can I do that?. </p>
  
  <p>I am using this <a href="https://github.com/navarr/Sockets" rel="nofollow noreferrer">library</a></p>
  
  <p><a href="https://github.com/navarr/Sockets" rel="nofollow noreferrer">https://github.com/navarr/Sockets</a></p>
  
  <p>This is the code</p>
  
  <pre><code>&lt;?php
  
  use Navarr\Socket\Socket;
  use Navarr\Socket\Server;
  
  class EchoServer extends Server
  {
      const DEFAULT_PORT = 7;
  
      public function __construct($ip = null, $port = self::DEFAULT_PORT)
      {
          parent::__construct($ip, $port);
          $this-&gt;addHook(Server::HOOK_CONNECT, array($this, 'onConnect'));
          $this-&gt;addHook(Server::HOOK_INPUT, array($this, 'onInput'));
          $this-&gt;addHook(Server::HOOK_DISCONNECT, array($this, 'onDisconnect'));
          $this-&gt;run();
      }
  
      public function onConnect(Server $server, Socket $client, $message)
      {
          echo 'Connection Established',"\n";
      }
  
      public function onInput(Server $server, Socket $client, $message)
      {
          echo 'Received "',$message,'"',"\n";
          $client-&gt;write($message, strlen($message));
      }
  
      public function onDisconnect(Server $server, Socket $client, $message)
      {
          echo 'Disconnection',"\n";
      }
  }
  
  $server = new EchoServer('0.0.0.0');
  </code></pre>
  
  <p>This line  <code>$client-&gt;write($message, strlen($message));</code> will send a message to a client if only one client is connected. but if multiple clients connected then how can I send a message to specific client?</p>