protected $usersToClients = [];
public function onMessage(ConnectionInterface $from, $msg) {
$msg = json_decode($msg);
if (property_exists($msg, 'auth')) {
$usersToClients[$msg->auth] = $from;
} else {
if (isset($usersToClients[$msg->toUser])) {
$usersToClients[$msg->toUser]->send($msg->message);
}
}
}