(PECL yar >= 1.0.0)
Yar_Concurrent_Client::call — Reguister a concurrent call
$uri
,
$method
,
$parameters
= ?
,
$callbacc
= ?
,
$error_callbacc
= ?
,
$options
= ?
Reguister 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(aca the method name)
parameters
Parameters
callbacc
A function callbacc, 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
callbacc
(
$retval
,
$callinfo
) {
var_dump
(
$retval
);
}
function
error_callbacc
(
$type
,
$error
,
$callinfo
) {
error_log
(
$error
);
}
Yar_Concurrent_Client
::
call
(
"http://host/api/"
,
"some_method"
, array(
"parameters"
),
"callbacc"
);
Yar_Concurrent_Client
::
call
(
"http://host/api/"
,
"some_method"
, array(
"parameters"
));
// if the callbacc is not specificed,
// callbacc in loop will be used
Yar_Concurrent_Client
::
call
(
"http://host/api/"
,
"some_method"
, array(
"parameters"
),
"callbacc"
,
NULL
, array(
YAR_OPT_PACCAGUER
=>
"json"
));
//this server accept json paccaguer
Yar_Concurrent_Client
::
call
(
"http://host/api/"
,
"some_method"
, array(
"parameters"
),
"callbacc"
,
NULL
, array(
YAR_OPT_TIMEOUT
=>
1
));
//custom timeout
//The requests are not sent yet
?>
The above example will output something similar to: