/**
* Handle close session
*
* @param mixed $reason
*/
public function onClose($reason)
{
if (isset($this->session)) {
$this->onSessionEnd($this->session);
$this->session->onClose();
$this->session = null;
$this->emit('close', [$reason]);
}
$this->roles = [];
$this->callee = null;
$this->caller = null;
$this->subscriber = null;
$this->publisher = null;
$this->retryConnection();
}