(PECL yar >= 1.0.0)
Yar_Concurrent_Client::call — Register a concurrent call
$uri
,$method
,$parameters
= ?,$callback
= ?,$error_callback
= ?,$options
= ?Register a RPC call, but won't sent it immediately, it will be send while further call to Yar_Concurrent_Client::loop()
uri
The RPC server URI(http, tcp)
method
Service name(aka the method name)
parameters
Parameters
callback
A function callback, which will be called while the response return.
An unique id, can be used to identified which call it is.
Example #1 Yar_Concurrent_Client::call() example
<?php
function callback($retval, $callinfo) {
var_dump($retval);
}
function error_callback($type, $error, $callinfo) {
error_log($error);
}
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters")); / if the callback is not specificed,
/ callback in loop will be used
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", NULL, array(YAR_OPT_PACKAGER => "json"));
/this server accept json packager
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", NULL, array(YAR_OPT_TIMEOUT=>1));
/custom timeout
/The requests are not sent yet
?>
The above example will output something similar to:
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant