mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
32
app/Server/Connections/HttpConnection.php
Normal file
32
app/Server/Connections/HttpConnection.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user