Property | Type | Description | |
---|---|---|---|
$connections | array | Store all connections of clients. | |
$count | integer | Number of worker processes. | |
$daemonize | boolean | Daemonize. | |
$globalEvent | Workerman\Events\EventInterface | Global event loop. | |
$group | string | Unix group of processes, needs appropriate privileges (usually root). | |
$id | integer | Worker id. | |
$logFile | mixed | Log file. | |
$name | string | Name of the worker processes. | |
$onBufferDrain | callback | Emitted when the send buffer becomes empty. | |
$onBufferFull | callback | Emitted when the send buffer becomes full. | |
$onClose | callback | Emitted when the other end of the socket sends a FIN packet. | |
$onConnect | callback | Emitted when a socket connection is successfully established. | |
$onError | callback | Emitted when an error occurs with connection. | |
$onMasterReload | callback | Emitted when the master process get reload signal. | |
$onMessage | callback | Emitted when data is received. | |
$onWorkerReload | callback | Emitted when worker processes get reload signal. | |
$onWorkerStart | callback | Emitted when worker processes start. | |
$onWorkerStop | callback | Emitted when worker processes stoped. | |
$pidFile | string | The file to store master process PID. | |
$protocol | Workerman\Protocols\ProtocolInterface | Application layer protocol. | |
$reloadable | boolean | reloadable. | |
$reusePort | boolean | reuse port. | |
$stdoutFile | string | Stdout file. | |
$transport | string | Transport layer protocol. | |
$user | string | Unix user of processes, needs appropriate privileges (usually root). |
Property | Type | Description | |
---|---|---|---|
$_autoloadRootPath | string | Root path for autoload. | |
$_availableEventLoops | array | Available event loops. | |
$_builtinTransports | array | PHP built-in protocols. | |
$_context | resource | Context of socket. | |
$_eventLoopName | string | Current eventLoop name. | |
$_globalStatistics | array | Status info of current worker process. | |
$_idMap | array | The format is like this [worker_id=>[0=>$pid, 1=>$pid, ..], ..]. | |
$_mainSocket | resource | Listening socket. | |
$_masterPid | integer | The PID of master process. | |
$_maxSocketNameLength | integer | Maximum length of the socket names. | |
$_maxUserNameLength | integer | Maximum length of the process user names. | |
$_maxWorkerNameLength | integer | Maximum length of the worker names. | |
$_pidMap | array | The format is like this [worker_id=>[pid=>pid, pid=>pid, ..], ..] | |
$_pidsToRestart | array | The format is like this [pid=>pid, pid=>pid]. | |
$_socketName | string | Socket name. The format is like this http://0.0.0.0:80 . | |
$_startFile | string | Start file. | |
$_statisticsFile | string | The file to store status info of current worker process. | |
$_status | integer | Current status. | |
$_workers | array | All worker instances. |
Method | Description | |
---|---|---|
__construct ( string $socket_name = '', array $context_option = [] ) | Construct. | |
acceptConnection ( resource $socket ) : void | Accept a connection. | |
acceptUdpConnection ( resource $socket ) : boolean | For udp package. | |
checkErrors ( ) : void | Check errors when current process exited. | |
getAllWorkers ( ) : array | Get all worker instances. | |
getEventLoop ( ) : Workerman\Events\EventInterface | Get global event-loop instance. | |
getSocketName ( ) : string | Get socket name. | |
listen ( ) | Listen port. | |
log ( string $msg ) : void | Log. | |
run ( ) : void | Run worker instance. | |
runAll ( ) : void | Run all worker instances. | |
safeEcho ( $msg ) | Safe Echo. | |
setUserAndGroup ( ) : void | Set unix user and group for current process. | |
signalHandler ( integer $signal ) | Signal handler. | |
stop ( ) : void | Stop current worker instance. | |
stopAll ( ) : void | Stop. |
Method | Description | |
---|---|---|
checkSapiEnv ( ) : void | Check sapi. | |
daemonize ( ) | Run as deamon mode. | |
displayUI ( ) : void | Display staring UI. | |
exitAndClearAll ( ) : void | Exit current process. | |
forkOneWorker ( |
Fork one worker process. | |
forkWorkers ( ) : void | Fork some worker processes. | |
getAllWorkerPids ( ) : array | Get all pids of worker processes. | |
getCurrentUser ( ) : string | Get unix user of current porcess. | |
getErrorType ( integer $type ) : string | Get error message by error code. | |
getEventLoopName ( ) : string | Get event loop name. | |
getId ( integer $worker_id, integer $pid ) | Get worker id. | |
init ( ) : void | Init. | |
initId ( ) | Init idMap. | |
initWorkers ( ) : void | Init All worker instances. | |
installSignal ( ) : void | Install signal handler. | |
monitorWorkers ( ) : void | Monitor all child processes. | |
parseCommand ( ) : void | Parse command. | |
reinstallSignal ( ) : void | Reinstall signal handler. | |
reload ( ) : void | Execute reload. | |
resetStd ( ) | Redirect standard input and output. | |
saveMasterPid ( ) | Save pid. | |
setProcessTitle ( string $title ) : void | Set process name. | |
writeStatisticsToStatusFile ( ) : void | Write statistics data to disk. |
public __construct ( string $socket_name = '', array $context_option = [] ) | ||
$socket_name | string | |
$context_option | array |
public acceptConnection ( resource $socket ) : void | ||
$socket | resource | |
return | void |
public acceptUdpConnection ( resource $socket ) : boolean | ||
$socket | resource | |
return | boolean |
public static checkErrors ( ) : void | ||
return | void |
protected static checkSapiEnv ( ) : void | ||
return | void |
protected static exitAndClearAll ( ) : void | ||
return | void |
protected static forkOneWorker ( |
||
$worker |
protected static forkWorkers ( ) : void | ||
return | void |
protected static getAllWorkerPids ( ) : array | ||
return | array |
public static getAllWorkers ( ) : array | ||
return | array |
protected static getCurrentUser ( ) : string | ||
return | string |
protected static getErrorType ( integer $type ) : string | ||
$type | integer | |
return | string |
public static getEventLoop ( ) : Workerman\Events\EventInterface | ||
return | Workerman\Events\EventInterface |
protected static getEventLoopName ( ) : string | ||
return | string |
protected static initWorkers ( ) : void | ||
return | void |
protected static installSignal ( ) : void | ||
return | void |
protected static monitorWorkers ( ) : void | ||
return | void |
protected static parseCommand ( ) : void | ||
return | void |
protected static reinstallSignal ( ) : void | ||
return | void |
protected static resetStd ( ) |
protected static setProcessTitle ( string $title ) : void | ||
$title | string | |
return | void |
public setUserAndGroup ( ) : void | ||
return | void |
public static signalHandler ( integer $signal ) | ||
$signal | integer |
protected static writeStatisticsToStatusFile ( ) : void | ||
return | void |
protected string $_autoloadRootPath | ||
return | string |
protected static array $_availableEventLoops | ||
return | array |
protected static array $_builtinTransports | ||
return | array |
protected static string $_eventLoopName | ||
return | string |
protected static array $_globalStatistics | ||
return | array |
protected static array $_idMap | ||
return | array |
protected resource $_mainSocket | ||
return | resource |
protected static int $_masterPid | ||
return | integer |
protected static int $_maxSocketNameLength | ||
return | integer |
protected static int $_maxUserNameLength | ||
return | integer |
protected static int $_maxWorkerNameLength | ||
return | integer |
protected static array $_pidMap | ||
return | array |
protected static array $_pidsToRestart | ||
return | array |
protected string $_socketName | ||
return | string |
protected static string $_startFile | ||
return | string |
protected static string $_statisticsFile | ||
return | string |
protected static int $_status | ||
return | integer |
protected static array $_workers | ||
return | array |
public array $connections | ||
return | array |
public static EventInterface,Workerman\Events $globalEvent | ||
return | Workerman\Events\EventInterface |
public string $group | ||
return | string |
public callback $onBufferDrain | ||
return | callback |
public callback $onBufferFull | ||
return | callback |
public callback $onClose | ||
return | callback |
public callback $onConnect | ||
return | callback |
public callback $onError | ||
return | callback |
public static callback $onMasterReload | ||
return | callback |
public callback $onMessage | ||
return | callback |
public callback $onWorkerReload | ||
return | callback |
public callback $onWorkerStart | ||
return | callback |
public callback $onWorkerStop | ||
return | callback |
public static string $pidFile | ||
return | string |
public ProtocolInterface,Workerman\Protocols $protocol | ||
return | Workerman\Protocols\ProtocolInterface |
public static string $stdoutFile | ||
return | string |
public string $user | ||
return | string |