socket = $socket; $this->host = $host; $this->subdomain = $subdomain; $this->client_id = $clientId; $this->authToken = $authToken; $this->serverHost = $serverHost; $this->shared_at = now()->toDateTimeString(); $this->client_version = QueryParameters::create($socket->httpRequest)->get('version'); } public function setMaximumConnectionLength(int $maximumConnectionLength) { $this->socket->send(json_encode([ 'event' => 'setMaximumConnectionLength', 'data' => [ 'length' => $maximumConnectionLength, ], ])); } public function registerProxy($requestId) { $this->socket->send(json_encode([ 'event' => 'createProxy', 'data' => [ 'host' => $this->host, 'subdomain' => $this->subdomain, 'request_id' => $requestId, 'client_id' => $this->client_id, ], ])); } public function close() { $this->socket->close(); } public function toArray() { return [ 'type' => 'http', 'host' => $this->host, 'remote_address' => $this->socket->remoteAddress, 'server_host' => $this->serverHost, 'client_id' => $this->client_id, 'client_version' => $this->client_version, 'auth_token' => $this->authToken, 'subdomain' => $this->subdomain, 'shared_at' => $this->shared_at, ]; } }