Listening to data reception events, what does $from_id in the callback function refer to? It's not the client ID. . .
//Create Server object and listen to port 127.0.0.1:9501
$serv = new swoole_server("127.0.0.1", 9501);
//Listen for connection entry events
$serv->on('connect', function ($serv, $fd) {
echo "Client: Connect.\n";
});
//Listen to data receiving events
$serv->on('receive', function ($serv, $fd, $from_id, $data) {
$serv->send($fd, "Server: ".$data);
});
//Listen to the connection close event
$serv->on('close', function ($serv, $fd) {
echo "Client: Close.\n";
});
//Start the server