Files
expose/app/Server/Connections/HttpConnection.php
Marcel Pociot f92bfbf3f7 wip
2020-05-04 14:55:27 +02:00

34 lines
549 B
PHP

<?php
namespace App\Server\Connections;
use Evenement\EventEmitterTrait;
use Ratchet\ConnectionInterface;
class HttpConnection
{
use EventEmitterTrait;
/** @var ConnectionInterface */
public $socket;
public function __construct(ConnectionInterface $socket)
{
$this->socket = $socket;
}
public function send($data)
{
$this->emit('data', [$data]);
$this->socket->send($data);
}
public function close()
{
$this->emit('close');
$this->socket->close();
}
}