LeProxy / React active user connections

i'm using and developing leproxy. this library is based on react php. i developed it and connected it to a remote server to get users dynamicly. but i have a problem for get username connections... how can i get connections of each username and limit connections of each user? in github issue i see this code:

$socket->on('connection', function ($connection) use (&$openSockets) {
    $openSockets++;
    $connection->on('end', function () use (&$openSockets) {
        $openSockets--;
    });

    echo $openSockets . "\t";
});

but connection showed is not really.

thanks a lot.