• Модуль: xmpp
  • Путь к файлу: ~/bitrix/modules/xmpp/classes/server.php
  • Класс: CXMPPServer
  • Вызов: CXMPPServer::__PingClients
private function __PingClients()
{
	$bRefineClientsList = false;

	$arClientsKeys = array_keys($this->arClients);
	foreach ($arClientsKeys as $id)
	{
		$pingTime = $this->arClients[$id]->GetPingTime();
		if (($pingTime > 0) && (time() - $pingTime > 900))
		{
			$this->WriteToLog("Client disconnected from PING (".$id.",".time()."-".$pingTime.")", 5);
			$this->arClients[$id]->Disconnect();
			$bRefineClientsList = true;
		}
		else
		{
			$this->arClients[$id]->Send(
				array(
					"iq" => array(
						"." => array(
							"type" => "get",
							"from" => $this->arClients[$id]->GetClientDomain(),
							"to" => $this->arClients[$id]->GetJId(),
							"id" => "pg".rand(10, 99),
						),
						"ping" => array(
							"." => array("xmlns" => "urn:xmpp:ping"),
						),
					),
				)
			);
		}
	}

	if ($bRefineClientsList)
	{
		$this->__RefineClientsList();
		$this->WriteToLog("Number of clients connected = ".count($this->arClients), 10);
		$this->startClearPeriodTime = time();
	}
}