public function onDisconnect(WebSocketSocket $socket) { $con = $socket->getConnection(); try { if ($con) { $handler = $this->_connections[$con]; if ($handler) { $this->uriHandlers[$handler]->removeConnection($con); } $this->_connections->detach($socket->getConnection()); } } catch (Exception $e) { $this->say("Exception occurred while handling message:\r\n" . $e->getTraceAsString()); } if ($con instanceof IWebSocketConnection) { foreach ($this->_observers as $o) { /** * @var @o IWebSocketServerObserver */ $o->onDisconnect($con); } } $this->sockets->detach($socket); }