\GatewayWorker\LibContext

上下文 包含当前用户 uid, 内部通信 local_ip local_port socket_id,以及客户端 client_ip client_port

Summary

Methods
Properties
Constants
sessionEncode()
sessionDecode()
clear()
addressToClientId()
clientIdToAddress()
$local_ip
$local_port
$client_ip
$client_port
$client_id
$connection_id
$old_session
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$local_ip

$local_ip : string

内部通讯 id

Type

string

$local_port

$local_port : integer

内部通讯端口

Type

integer

$client_ip

$client_ip : string

客户端 ip

Type

string

$client_port

$client_port : integer

客户端端口

Type

integer

$client_id

$client_id : string

client_id

Type

string

$connection_id

$connection_id : integer

连接 connection->id

Type

integer

$old_session

$old_session : string

旧的session

Type

string

Methods

sessionEncode()

sessionEncode(mixed  $session_data = '') : string

编码 session

Parameters

mixed $session_data

Returns

string

sessionDecode()

sessionDecode(string  $session_buffer) : mixed

解码 session

Parameters

string $session_buffer

Returns

mixed

clear()

clear() : void

清除上下文

addressToClientId()

addressToClientId(integer  $local_ip, integer  $local_port, integer  $connection_id) : string

通讯地址到 client_id 的转换

Parameters

integer $local_ip
integer $local_port
integer $connection_id

Returns

string

clientIdToAddress()

clientIdToAddress(string  $client_id) : array

client_id 到通讯地址的转换

Parameters

string $client_id

Throws

\Exception

Returns

array