public function onClose()
{
if ($this->realm !== null) {
// only send the leave metaevent if we actually made it into the realm
if ($this->isAuthenticated()) {
// metaevent
$metaInfo = $this->getMetaInfo();
$this->getRealm()->publishMeta('wamp.metaevent.session.on_leave', [$metaInfo]);
Logger::info($this, "Session close: " . json_encode($metaInfo));
}
$this->dispatcher->dispatch("LeaveRealm", new LeaveRealmEvent($this->realm, $this));
$this->realm = null;
}
}