/** * Logs an application error * * @see Varspool\WebsocketBundle\Application.Application::log() */ public function log($message, $level = 'info', Connection $client = null) { if ($this->debug) { parent::log($message, $level); if ($this->remoteLogging) { $log = new stdClass(); $log->type = 'log'; $log->level = $level; $log->message = $message; $log = $this->getJsonPayload($log); if ($client) { $client->send(Protocol::toString(Protocol::TYPE_MESSAGE, self::TOPIC_LOG_SERVER, $log)); } else { $this->getChannel(self::TOPIC_LOG_SERVER)->send($log); } } } }
/** * @param Connection $client */ private function _sendServerinfo($client) { if (count($this->_clients) < 1) { return false; } $currentServerInfo = $this->_serverInfo; $currentServerInfo['clientCount'] = count($this->_serverClients); $currentServerInfo['clients'] = $this->_serverClients; $encodedData = $this->_encodeData('serverInfo', $currentServerInfo); $client->send($encodedData); }