PHP Class DoraRPC\Server

Show file Open project: xcl3721/dora-rpc

Protected Properties

Property Type Description
$httpConfig
$tcpConfig

Public Methods

Method Description
__construct ( $ip = "0.0.0.0", $port = 9567, $httpport = 9566 )
__destruct ( )
configure ( array $config ) Configuration Server.必须在start之前执行
discovery ( array $group, array $report ) 启动服务发现服务
doWork ( $param )
initServer ( $server )
initTask ( $server, $worker_id )
onFinish ( $serv, $task_id, $data ) task process finished
onHttpFinished ( $serv, $task_id, $data, $response ) http task finished process
onManagerStart ( swoole_server $serv ) application server first start
onManagerStop ( swoole_server $serv )
onReceive ( swoole_server $serv, $fd, $from_id, $data ) tcp request process
onRequest ( swoole_http_request $request, swoole_http_response $response ) http request process
onStart ( swoole_server $serv ) application server first start
onTask ( $serv, $task_id, $from_id, $data )
onWorkerError ( swoole_server $serv, $worker_id, $worker_pid, $exit_code )
onWorkerStart ( $server, $worker_id ) worker and task init
start ( ) : void; Start Server.

Protected Methods

Method Description
getLocalIp ( ) : string 获取当前服务器ip,用于服务发现上报IP

Method Details

__construct() final public method

final public __construct ( $ip = "0.0.0.0", $port = 9567, $httpport = 9566 )

__destruct() final public method

final public __destruct ( )

configure() public method

Configuration Server.必须在start之前执行
public configure ( array $config )
$config array

discovery() public method

启动服务发现服务
public discovery ( array $group, array $report )
$group array
$report array

doWork() abstract public method

abstract public doWork ( $param )

getLocalIp() protected method

获取当前服务器ip,用于服务发现上报IP
protected getLocalIp ( ) : string
return string

initServer() abstract public method

abstract public initServer ( $server )

initTask() abstract public method

abstract public initTask ( $server, $worker_id )

onFinish() final public method

task process finished
final public onFinish ( $serv, $task_id, $data )

onHttpFinished() final public method

http task finished process
final public onHttpFinished ( $serv, $task_id, $data, $response )

onManagerStart() final public method

application server first start
final public onManagerStart ( swoole_server $serv )
$serv swoole_server

onManagerStop() final public method

final public onManagerStop ( swoole_server $serv )
$serv swoole_server

onReceive() final public method

tcp request process
final public onReceive ( swoole_server $serv, $fd, $from_id, $data )
$serv swoole_server

onRequest() final public method

http request process
final public onRequest ( swoole_http_request $request, swoole_http_response $response )
$request swoole_http_request
$response swoole_http_response

onStart() final public method

application server first start
final public onStart ( swoole_server $serv )
$serv swoole_server

onTask() final public method

final public onTask ( $serv, $task_id, $from_id, $data )

onWorkerError() final public method

final public onWorkerError ( swoole_server $serv, $worker_id, $worker_pid, $exit_code )
$serv swoole_server

onWorkerStart() final public method

worker and task init
final public onWorkerStart ( $server, $worker_id )

start() public method

Start Server.
public start ( ) : void;
return void;

Property Details

$httpConfig protected property

protected $httpConfig

$tcpConfig protected property

protected $tcpConfig