19 $this->serverUrl =
$options[
'serverUrl'] ?? Config::getJsonRpcUrl();
20 $this->hostname =
$options[
'hostname'] ?? Config::getHostname();
32 $result->withRemoteAddress($this->serverUrl);
35 $batchList = static::createRequestBatches(
$messages);
42 foreach ($batchList as $batch)
44 $executeResult = $this->
executeBatch($this->serverUrl, $batch);
45 if (!$executeResult->isSuccess())
47 return $result->addErrors($executeResult->getErrors());
58 static::METHOD_GET_LAST_SEEN,
64 if (!$rpcResult->isSuccess())
86 static::METHOD_UPDATE_LAST_SEEN,
98 $maxPayload = \CPullOptions::GetMaxPayload() - 20;
102 $currentBatchSize = 2;
108 if (mb_strlen($jsonRpcMessage) > $maxPayload - 20)
110 trigger_error(
"Pull message exceeds size limit, skipping", E_USER_WARNING);
112 if (($currentBatchSize + mb_strlen($jsonRpcMessage)) + 1> $maxPayload)
115 $result[] =
"[" . implode(
",", $currentBatch) .
"]";
117 $currentBatchSize = 2;
119 $currentBatch[] = $jsonRpcMessage;
120 $currentBatchSize += (mb_strlen($jsonRpcMessage)) + 1;
122 if (
count($currentBatch) > 0)
124 $result[] =
"[" . implode(
",", $currentBatch) .
"]";
137 'jsonrpc' => static::VERSION,
152 catch (\Throwable $e)
157 if (!$httpResult->isSuccess())
159 return $result->addErrors($httpResult->getErrors());
178 if (!$httpResult->isSuccess())
180 return $result->addErrors($httpResult->getErrors());
193 $hostId = (string)Config::getHostId();
194 $additionalParams = [
"hostId" => $hostId,
"signature" => $signature];
195 if ($this->hostname !=
'')
201 $sendResult = $httpClient->query(
Main\
Web\HttpClient::HTTP_POST, $urlWithSignature, $body);
204 $errorCode = array_key_first($httpClient->getError());
205 $errorMsg = $httpClient->getError()[$errorCode];
208 $responseCode = (int)$httpClient->getStatus();
209 if ($responseCode !== 200)
211 return $result->addError(
new Main\
Error(
"Unexpected server response code {$responseCode}"));
213 $responseBody = $httpClient->getResult();
214 if ($responseBody ==
'')
222 catch (\Throwable $e)
224 return $result->addError(
new Main\
Error(
'Could not decode server response. Raw response: ' . $responseBody));
227 return $result->setData($decodedBody);
static encode($data, $options=null)
sendMessages(array $messages)
__construct(array $options=[])
const METHOD_GET_LAST_SEEN
static createJsonRpcRequest(string $method, $params)
executeMethod(string $queueServerUrl, string $method, array $params)
const METHOD_UPDATE_LAST_SEEN
getUsersLastSeen(array $userList)
performHttpRequest(string $queueServerUrl, string $body)
updateUsersLastSeen(array $userTimestamps)
static createRequestBatches(array $messages)
executeBatch(string $queueServerUrl, string $batchBody)
static urlAddParams($url, $add_params, $options=[])
static GetSignature($value, $signatureKey=null)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']