/** * 下线时,通知所有人 */ function onClose($serv, $client_id, $from_id) { //将下线消息发送给所有人 //$this->log("onOffline: " . $client_id); //$this->broadcast($client_id, "onOffline: " . $client_id); parent::onClose($serv, $client_id, $from_id); }
/** * @param $serv swoole_server * @param int $worker_id */ function onStart($serv, $worker_id = 0) { Swoole::$php->router(array($this, 'router')); parent::onStart($serv, $worker_id); }