• Модуль: pull
  • Путь к файлу: ~/bitrix/modules/pull/lib/push/message/applemessage.php
  • Класс: BitrixPullPushMessageAppleMessage
  • Вызов: AppleMessage::getBatch
public function getBatch()
{
	$arTokens = $this->getRecipients();
	$sPayload = $this->getPayload();

	if (!$sPayload)
	{
		return false;
	}

	$nPayloadLength = strlen($sPayload);
	$totalBatch = "";
	foreach ($arTokens as $token)
	{
		$sDeviceToken = $token;

		$sRet = pack('CNNnH*',
			1,
			$this->getCustomIdentifier(),
			$this->getExpiry() > 0 ? time() + $this->getExpiry() : 0,
			32,
			$sDeviceToken)
		;
		$sRet .= pack('n', $nPayloadLength);
		$sRet .= $sPayload;
		if ($totalBatch <> '')
		{
			$totalBatch .= ";";
		}
		$totalBatch .= base64_encode($sRet);
	}

	return $totalBatch;
}