This commit is contained in:
Marcel Pociot
2020-04-22 12:32:29 +02:00
parent 1f8865145f
commit e5e53b8b68
41 changed files with 1593 additions and 915 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Server\Connections;
use Evenement\EventEmitterTrait;
use GuzzleHttp\Psr7\Request;
use Illuminate\Support\Str;
use Nyholm\Psr7\Factory\Psr17Factory;
use Ratchet\Client\WebSocket;
use Ratchet\ConnectionInterface;
use Ratchet\RFC6455\Messaging\Frame;
use Ratchet\WebSocket\WsConnection;
use React\Stream\Util;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
class ControlConnection
{
use EventEmitterTrait;
/** @var ConnectionInterface */
public $socket;
public $host;
public $subdomain;
public $client_id;
public $proxies = [];
public function __construct(ConnectionInterface $socket, string $host, string $subdomain, string $clientId)
{
$this->socket = $socket;
$this->host = $host;
$this->subdomain = $subdomain;
$this->client_id = $clientId;
}
public function registerProxy($requestId)
{
$this->socket->send(json_encode([
'event' => 'createProxy',
'request_id' => $requestId,
'client_id' => $this->client_id,
]));
}
}