PHP 클래스 Swoole\Client\RPC

파일 보기 프로젝트 열기: matyhtf/swoole_framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_instances
$encode_gzip
$encode_json
$env
$haveSockets
$haveSwoole
$keepConnection boolean 启用长连接
$packet_maxlen
$password
$requestIndex
$servers array Server的实例列表
$timeout
$user
$waitList

공개 메소드들

메소드 설명
__construct ( $id = null )
addServers ( array $servers ) 添加服务器
auth ( $user, $password ) 设置用户名和密码
getEnv ( ) : array 设置环境变量
getInstance ( $id = null ) : RPC 获取SOA服务实例
getRequestId ( ) : integer 生成请求串号
getServer ( ) : array 从配置中取出一个服务器配置
onConnectServerFailed ( $svr ) : boolean 连接服务器失败了
ping ( ) 侦测服务器是否存活
putEnv ( $k, $v ) 设置一项环境变量
setEncodeType ( $json, $gzip ) 设置编码类型
setEnv ( array $env ) 获取环境变量
setServers ( array $servers ) 设置服务器
setTimeout ( $timeout ) 设置超时时间,包括连接超时和接收超时
task ( $function, $params = [], $callback = null ) : SOA_Result RPC调用
wait ( float $timeout = 0.5 ) : integer 并发请求

보호된 메소드들

메소드 설명
afterRequest ( $retObj )
beforeRequest ( $retObj )
connectToServer ( SOA_Result $retObj ) : boolean 连接到服务器
finish ( $retData, $retObj ) 完成请求
formatServerConfig ( &$config )
recvWaitWithSockets ( $timeout ) : integer 使用sockets扩展
recvWaitWithSwoole ( $timeout ) : integer 使用Swoole扩展
request ( $send, SOA_result $retObj ) : boolean 发送请求

메소드 상세

__construct() 공개 메소드

public __construct ( $id = null )

addServers() 공개 메소드

添加服务器
public addServers ( array $servers )
$servers array

afterRequest() 보호된 메소드

protected afterRequest ( $retObj )

auth() 공개 메소드

设置用户名和密码
public auth ( $user, $password )
$user
$password

beforeRequest() 보호된 메소드

protected beforeRequest ( $retObj )

connectToServer() 보호된 메소드

连接到服务器
protected connectToServer ( SOA_Result $retObj ) : boolean
$retObj SOA_Result
리턴 boolean

finish() 보호된 메소드

完成请求
protected finish ( $retData, $retObj )
$retData
$retObj

formatServerConfig() 보호된 정적인 메소드

protected static formatServerConfig ( &$config )
$config

getEnv() 공개 메소드

设置环境变量
public getEnv ( ) : array
리턴 array

getInstance() 정적인 공개 메소드

获取SOA服务实例
static public getInstance ( $id = null ) : RPC
$id
리턴 RPC

getRequestId() 정적인 공개 메소드

生成请求串号
static public getRequestId ( ) : integer
리턴 integer

getServer() 공개 메소드

从配置中取出一个服务器配置
public getServer ( ) : array
리턴 array

onConnectServerFailed() 공개 메소드

连接服务器失败了
public onConnectServerFailed ( $svr ) : boolean
$svr
리턴 boolean

ping() 공개 메소드

侦测服务器是否存活
public ping ( )

putEnv() 공개 메소드

设置一项环境变量
public putEnv ( $k, $v )
$k
$v

recvWaitWithSockets() 보호된 메소드

使用sockets扩展
protected recvWaitWithSockets ( $timeout ) : integer
$timeout
리턴 integer

recvWaitWithSwoole() 보호된 메소드

使用Swoole扩展
protected recvWaitWithSwoole ( $timeout ) : integer
$timeout
리턴 integer

request() 보호된 메소드

发送请求
protected request ( $send, SOA_result $retObj ) : boolean
$send
$retObj SOA_result
리턴 boolean

setEncodeType() 공개 메소드

设置编码类型
public setEncodeType ( $json, $gzip )
$json
$gzip

setEnv() 공개 메소드

获取环境变量
public setEnv ( array $env )
$env array

setServers() 공개 메소드

设置服务器
public setServers ( array $servers )
$servers array

setTimeout() 공개 메소드

设置超时时间,包括连接超时和接收超时
public setTimeout ( $timeout )
$timeout

task() 공개 메소드

RPC调用
public task ( $function, $params = [], $callback = null ) : SOA_Result
$function
$params
$callback
리턴 SOA_Result

wait() 공개 메소드

并发请求
public wait ( float $timeout = 0.5 ) : integer
$timeout float
리턴 integer

프로퍼티 상세

$_instances 보호되어 있는 정적으로 프로퍼티

protected static $_instances

$encode_gzip 보호되어 있는 프로퍼티

protected $encode_gzip

$encode_json 보호되어 있는 프로퍼티

protected $encode_json

$env 보호되어 있는 프로퍼티

protected $env

$haveSockets 보호되어 있는 프로퍼티

protected $haveSockets

$haveSwoole 보호되어 있는 프로퍼티

protected $haveSwoole

$keepConnection 보호되어 있는 프로퍼티

启用长连接
protected bool $keepConnection
리턴 boolean

$packet_maxlen 보호되어 있는 프로퍼티

protected $packet_maxlen

$password 보호되어 있는 프로퍼티

protected $password

$requestIndex 보호되어 있는 프로퍼티

protected $requestIndex

$servers 보호되어 있는 프로퍼티

Server的实例列表
protected array $servers
리턴 array

$timeout 보호되어 있는 프로퍼티

protected $timeout

$user 보호되어 있는 프로퍼티

protected $user

$waitList 보호되어 있는 프로퍼티

protected $waitList