search

Home  >  Q&A  >  body text

php - What does the $from_id received in swoole_server mean?

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
天蓬老师天蓬老师2823 days ago533

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 13:05:01

    This is ReactorThreadId

    reply
    0
  • Cancelreply