PHP Class Swoole\Protocol\RPCServer

Inheritance: extends Base, implements Swoole\IFace\Protocol
ファイルを表示 Open project: matyhtf/swoole_framework Class Usage Examples

Public Properties

Property Type Description
$clientEnv array 客户端环境变量
$packet_maxlen
$requestHeader array 请求头
$stop

Protected Properties

Property Type Description
$_buffer
$_headers buffer区
$appNamespaces
$buffer_clear_num 最大待处理区排队长度, 超过后将丢弃最早入队数据
$buffer_maxlen 2M默认最大长度
$errCode 保存头
$errMsg
$ipWhiteList 应用程序命名空间
$userList IP白名单
$verifyIp 用户列表
$verifyUser

Public Methods

Method Description
addAllowIP ( $ip ) 添加访问规则
addAllowUser ( $user, $password )
addNameSpace ( $name, $path ) 增加命名空间
decode ( string $data, integer $unseralize_type = self::DECODE_PHP ) : string 解包数据
encode ( $data, $type = self::DECODE_PHP, $uid, $serid ) : string 打包数据
getClientEnv ( ) : array 获取客户端环境信息
getRequestHeader ( ) : array 获取请求头信息,包括UID、Serid串号等
onClose ( $serv, integer $fd, $from_id )
onReceive ( $serv, $fd, $from_id, $data )
onShutdown ( $server )
onTimer ( $serv, $interval )
onWorkerStop ( $serv, $worker_id )
sendErrorMessage ( $fd, $errno )

Protected Methods

Method Description
call ( $request, $header ) : array 调用远程函数
close ( $fd ) 关闭连接
verifyIp ( $ip ) : boolean 验证IP
verifyUser ( $user, $password ) : boolean 验证用户名密码

Method Details

addAllowIP() public method

添加访问规则
public addAllowIP ( $ip )
$ip

addAllowUser() public method

public addAllowUser ( $user, $password )

addNameSpace() public method

增加命名空间
public addNameSpace ( $name, $path )
$name
$path

call() protected method

调用远程函数
protected call ( $request, $header ) : array
$request
return array

close() protected method

关闭连接
protected close ( $fd )
$fd

decode() static public method

解包数据
static public decode ( string $data, integer $unseralize_type = self::DECODE_PHP ) : string
$data string
$unseralize_type integer
return string

encode() static public method

打包数据
static public encode ( $data, $type = self::DECODE_PHP, $uid, $serid ) : string
$data
$type
$uid
$serid
return string

getClientEnv() static public method

获取客户端环境信息
static public getClientEnv ( ) : array
return array

getRequestHeader() static public method

获取请求头信息,包括UID、Serid串号等
static public getRequestHeader ( ) : array
return array

onClose() public method

public onClose ( $serv, integer $fd, $from_id )
$serv
$fd integer
$from_id

onReceive() public method

public onReceive ( $serv, $fd, $from_id, $data )

onShutdown() public method

public onShutdown ( $server )

onTimer() public method

public onTimer ( $serv, $interval )

onWorkerStop() public method

public onWorkerStop ( $serv, $worker_id )

sendErrorMessage() public method

public sendErrorMessage ( $fd, $errno )

verifyIp() protected method

验证IP
protected verifyIp ( $ip ) : boolean
$ip
return boolean

verifyUser() protected method

验证用户名密码
protected verifyUser ( $user, $password ) : boolean
$user
$password
return boolean

Property Details

$_buffer protected_oe property

protected $_buffer

$_headers protected_oe property

buffer区
protected $_headers

$appNamespaces protected_oe property

protected $appNamespaces

$buffer_clear_num protected_oe property

最大待处理区排队长度, 超过后将丢弃最早入队数据
protected $buffer_clear_num

$buffer_maxlen protected_oe property

2M默认最大长度
protected $buffer_maxlen

$clientEnv static_oe public_oe property

客户端环境变量
static public array $clientEnv
return array

$errCode protected_oe property

保存头
protected $errCode

$errMsg protected_oe property

protected $errMsg

$ipWhiteList protected_oe property

应用程序命名空间
protected $ipWhiteList

$packet_maxlen public_oe property

public $packet_maxlen

$requestHeader static_oe public_oe property

请求头
static public array $requestHeader
return array

$stop static_oe public_oe property

static public $stop

$userList protected_oe property

IP白名单
protected $userList

$verifyIp protected_oe property

用户列表
protected $verifyIp

$verifyUser protected_oe property

protected $verifyUser