PHP WebSocket – How send message to specified client? -


sending messages clients looks this:

function send_message($msg) {     global $clients;     foreach($clients $changed_socket)     {         socket_write($changed_socket, $msg, strlen($msg));     }     return true; } 

how can send message specified client, example client #2? $clients array looks this:

array (    [0]    [1]    [2]    [3] ) 

instead of running foreach loop send messages every client, send 1 want.

function send_message($msg) {     global $clients;     socket_write($clients[2], $msg, strlen($msg));     return true; } 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -