A controller can set the nickname to in the session:
/**
* @Route("/hello/{nickname}")
*/
public function indexAction($nickname)
{
$session = $this->getRequest()->getSession();
$session->set('nickname', $nickname);
}
To retrieve the nickname in your Chat app,
public function onOpen(ConnectionInterface $conn)
{
$nickname = $conn->Session->get('nickname');
}