How does Workerman?

Work here with this example https://github.com/morozovsk/workerman-examples/bl... and here there is such moment:
$ws_worker->onConnect = function($connection) use (&$users)
{
 $connection->onWebSocketConnect = function($connection) use (&$users)
{
 // put the get parameter in a collection $users the user
 // on the page you can set any parameter. for example client.html: ws = new WebSocket("ws://127.0.0.1:8000/?user=tester01");
 $users[$_GET['user']] = $connection;
 // or you can use another parameter for user identification, for example $_COOKIE['PHPSESSID']
};
};

can't catch how to pass the GET method or COOKI
writes a here is the error:
Undefined property: Workerman\Connection\TcpConnection::$uid in file /socket.php on line 22

this line here:
$ws_worker->onClose = function($connection) use(&$users)
{
if(isset($users[$connection->uid]))
{
 // disable when the user disconnects
unset($users[$connection->uid]);
}
};

I hope someone knows what's wrong, I understand that he can't define, but why XS...
March 23rd 20 at 19:12
1 answer
March 23rd 20 at 19:14
$_GET['user'] = 'foo';
$ws_worker->onConnect = function($connection) use (&$users)
{
 // $_GET['user'] = 'foo2';
 $connection->onWebSocketConnect = function($connection) use (&$users)
{
 // put the get parameter in a collection $users the user
 // on the page you can set any parameter. for example client.html: ws = new WebSocket("ws://127.0.0.1:8000/?user=tester01");
 $users[$_GET['user']] = $connection;
 // or you can use another parameter for user identification, for example $_COOKIE['PHPSESSID']
};
};
$_GET/$_POST/$_COOKIE are global variables - Pascale_Wunsch commented on March 23rd 20 at 19:17
@Pascale_Wunsch, why can't he determine this parameter $connection->uid? - henri_Morar commented on March 23rd 20 at 19:20
@henri_Morar, written as "Undefined property" - Pascale_Wunsch commented on March 23rd 20 at 19:23
@Pascale_Wunsch, well, then I realized that an undefined property, and what is connected? - henri_Morar commented on March 23rd 20 at 19:26
@henri_Morar, so that the object does not have such properties. finish the code in the Notepad to write and get into the IDE, here are a couple free: https://eclipse.org/pdt/ more complicated/more powerful, https://netbeans.org/downloads/8.2/ easier (only versions above do not put, there is not yet to move half of the plugins) - Pascale_Wunsch commented on March 23rd 20 at 19:29
@henri_Morar, https://github.com/walkor/Workerman/blob/master/Co... where did you here the uid found? - Pascale_Wunsch commented on March 23rd 20 at 19:32

Find more questions by tags PHP