Construct.
public __construct ( string $socket_name = '', array $context_option = [] ) | ||
$socket_name | string | |
$context_option | array |
public function __construct($socket_name) { parent::__construct($socket_name); $this->onWorkerStart = array($this, 'onStart'); $this->onMessage = array($this, 'onMessage'); $this->onWorkerStop = array($this, 'onStop'); }
/** * 修改原构造方法 * * @param array $config */ public function __construct($config) { parent::__construct(Arr::get($config, 'socketName'), Arr::get($config, 'contextOptions')); // 设置数据 foreach ($config as $k => $v) { if (isset($this->{$k})) { $this->{$k} = $v; } } }
/** * Construct. * * @param string $socket_name * @param array $context_option */ public function __construct($socket_name, $context_option = array()) { list(, $address) = explode(':', $socket_name, 2); parent::__construct('http:' . $address, $context_option); $this->name = 'WebServer'; }
/** * 构造函数 * @param string $socket_name * @param array $context_option */ public function __construct($socket_name, $context_option = array()) { parent::__construct($socket_name, $context_option); $this->router = array("\\GatewayWorker\\Gateway", 'routerBind'); $backrace = debug_backtrace(); $this->_appInitPath = dirname($backrace[0]['file']); }
/** * 构造函数 * @param string $socket_name * @param array $context_option */ public function __construct($socket_name = '', $context_option = array()) { parent::__construct($socket_name, $context_option); $backrace = debug_backtrace(); $this->_appInitPath = dirname($backrace[0]['file']); }
/** * construct */ public function __construct($socket_name) { parent::__construct($socket_name); $this->onWorkerStart = array($this, 'onStart'); $this->onConnect = array($this, 'onConnect'); }
/** * construt * @param string $socket_name */ public function __construct($socket_name) { parent::__construct($socket_name); $this->onMessage = array($this, 'onMessage'); }
/** * 构造函数 * @param string $socket_name * @param array $context_option */ public function __construct($socket_name, $context_option = array()) { parent::__construct($socket_name, $context_option); list(, , $this->_gatewayPort) = explode(':', $socket_name); $this->router = array("\\Utils\\GatewayWorker\\Gateway", 'routerBind'); $backrace = debug_backtrace(); $this->_autoloadRootPath = dirname($backrace[0]['file']); }