php - What does the $from_id received in swoole_server mean?
天蓬老师
天蓬老师 2017-05-16 13:03:01
0
1
538

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

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
Peter_Zhu

This is ReactorThreadId

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template