payload = $payload; $this->connection = $connection; $this->connectionManager = $connectionManager; } public function respond() { $eventName = $this->payload->event; if (method_exists($this, $eventName)) { call_user_func([$this, $eventName], $this->connection, $this->payload->data ?? new stdClass()); } } protected function authenticate(ConnectionInterface $connection, $data) { $connectionInfo = $this->connectionManager->storeConnection($data->host, $data->subdomain, $connection); $connection->send(json_encode([ 'event' => 'authenticated', 'subdomain' => $connectionInfo->subdomain, 'client_id' => $connectionInfo->client_id ])); } protected function registerProxy(ConnectionInterface $connection, $data) { $connectionInfo = $this->connectionManager->findConnectionForClientId($data->client_id); $connectionInfo->socket->getConnection()->emit('proxy_ready_'.$data->request_id, [ $connection, ]); $connectionInfo->setProxy($connection); } }