class Yar_Concurrent_Client (View source)

Properties

static protected $_callstack
static protected $_callback
static protected $_error_callback
static protected $_start

Methods

static int
call(string $uri, string $method, array $parameters, callable $callback = null, callable $error_callback, array $options)

Register a concurrent call

static bool
loop(callable $callback = null, callable $error_callback = null)

Send all calls

static bool
reset()

Clean all registered calls Clean all registered calls

Details

static int call(string $uri, string $method, array $parameters, callable $callback = null, callable $error_callback, array $options)

Register a concurrent call

Parameters

string $uri

The RPC server URI(http, tcp)

string $method

Service name(aka the method name)

array $parameters Parameters
callable $callback

A function callback, which will be called while the response return.

callable $error_callback

A function callback, which will be called while the response return.

array $options

Return Value

int

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

static bool loop(callable $callback = null, callable $error_callback = null)

Send all calls

Parameters

callable $callback

If this callback is set, then Yar will call this callback after all calls are sent and before any response return, with a $callinfo NULL. Then, if user didn't specify callback when registering concurrent call, this callback will be used to handle response, otherwise, the callback specified while registering will be used.

callable $error_callback

If this callback is set, then Yar will call this callback while error occurred.

Return Value

bool

static bool reset()

Clean all registered calls Clean all registered calls

Return Value

bool