\Worker\Built\JsonRpcJsonRpcClient

This is a Json Rpc client for this process to interact with services of other processes.

Workers of all network types in this process can access the services of other processes through Json Rpc Client. During passive fork, the connection between the current process and other rpc services should be re-established.

The original Json Rpc client passively accepts responses and resumes coroutines, but this approach is not elegant enough But that's not enough, it should be able to handle passively accepting requests

Summary

Methods
Properties
Constants
__construct()
addService()
connect()
call()
onMessage()
forkPassive()
$clientId
$rpcServices
$rpcServiceConnections
$rpcServiceAddressList
$facadeClass
No constants found
No protected methods found
No protected properties found
N/A
connectProcessManager()
noticeRpcServiceOnline()
noticeRpcServiceOffline()
No private properties found
N/A

Properties

$clientId

$clientId : int

Client ID

Type

int

$rpcServices

$rpcServices : \Worker\Worker[]

Type

Worker[]

$rpcServiceConnections

$rpcServiceConnections : \Worker\Socket\TCPConnection[]

Type

TCPConnection[]

$rpcServiceAddressList

$rpcServiceAddressList : array

Type

array

$facadeClass

$facadeClass : string

Type

string

Methods

__construct()

__construct() : mixed

initialize

Returns

mixed —

addService()

addService(string  $name, string  $address, string  $type) : void

连接RPC服务器

Parameters

string $name
string $address
string $type

Throws

\Exception

connect()

connect(string  $name, string  $address, string  $type) : void

连接RPC服务器

Parameters

string $name
string $address
string $type

Throws

\Exception

call()

call(array  $route, mixed  ...$arguments) : mixed

Parameters

array $route
mixed $arguments variadic

Throws

\Worker\Built\JsonRpc\Exception\RpcException
\Exception

Returns

mixed —

onMessage()

onMessage(string  $context, \Worker\Socket\TCPConnection  $client) : void

Parameters

string $context
\Worker\Socket\TCPConnection $client

forkPassive()

forkPassive() : void

The child process has its own RPC service connection 进程分生后会自动驱动当前子进程重连主程ProcessMassager提供的RPC服务

connectProcessManager()

connectProcessManager() : bool

Throws

\Exception

Returns

bool —

noticeRpcServiceOnline()

noticeRpcServiceOnline(string  $name, string  $address, string  $type) : void

Parameters

string $name
string $address
string $type

noticeRpcServiceOffline()

noticeRpcServiceOffline(string  $name) : void

Parameters

string $name