public function start($config, $settings) { // override $config['deal_with_public'] = false; parent::init($config); $this->settings = $settings; if (!empty($this->settings)) { $this->server->set($this->settings); } $this->server->on('Start', [$this, 'onServerStart']); $this->server->on('Receive', [$this, 'onReceive']); $this->server->on('Shutdown', [$this, 'onServerShutdown']); $this->server->on('WorkerStart', [$this, 'onWorkerStart']); $this->server->start(); }
public function endResponse($response, $content) { if (isset($response->request)) { // This is a websocket request $data = $this->connections[$response->request->fd]['protocol']::encode($response->http_status, $response->request->method, $content, $response->request->echo); $this->server->push($response->request->fd, $data); } else { // This is a http request parent::endResponse($response, $content); } }