/** * 连接服务注册中心 * @return void */ public function connectToRegister() { $this->_registerConnection = new AsyncTcpConnection("text://{$this->registerAddress}"); $this->_registerConnection->send('{"event":"worker_connect"}'); $this->_registerConnection->onClose = array($this, 'onRegisterConnectionClose'); $this->_registerConnection->onMessage = array($this, 'onRegisterConnectionMessage'); $this->_registerConnection->connect(); }