/** * Revoke client connection listeners */ protected function revokeListeners() { foreach (['response', 'error'] as $listener) { $this->listeners[$listener] = $this->conn->listeners('api-' . $listener); $this->conn->removeAllListeners('api-' . $listener); } }
/** * A slave sent a `status` command. * * @param array $data * @param Connection $conn */ protected function commandStatus(array $data, Connection $conn) { //remove nasty info about worker's bootstrap fail $conn->removeAllListeners('close'); if ($this->output->isVeryVerbose()) { $conn->on('close', function () { $this->output->writeln('Status command requested'); }); } $conn->end(json_encode(['slaveCount' => $this->slaveCount, 'handledRequests' => $this->handledRequests])); }
protected function initWebSocket(SocketConnection $conn, Request $request) { $conn->removeAllListeners('data'); return new WebSocketProtocol($conn, $this->app, $request); }