Symfony
- 1 ответ
- 0 вопросов
0
Вклад в тег
conn.onopen = function(e) {
conn.send(JSON.stringify({userId : document.getElementById('user_id').value}));
};
ConnectionInterface $conn
public function onMessage(ConnectionInterface $from, $msg)
{
$data = json_decode($msg);
if (property_exists($data, 'userId')) {
$userId = $data->userId;
$from->userId = $userId;
$this->users[$userId] = $from;
} else {
$this->users[$data->to]->send($msg);
}
}