Yar_Concurrent_Client::call

(PECL yar >= 1.0.0)

Yar_Concurrent_Client::callRegister a concurrent call

Description

publicstaticYar_Concurrent_Client::call(
    string$uri,
    string$method,
    array$parameters = ?,
    callable$callback = ?,
    callable$error_callback = ?,
    array$options = ?
): int

Register a RPC call, but won't sent it immediately, it will be send while further call to Yar_Concurrent_Client::loop()

Parameters

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.

Return Values

An unique id, can be used to identified which call it is.

Examples

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,

The above example will output something similar to:

See Also

To Top