mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
33 lines
548 B
PHP
33 lines
548 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();
|
|
}
|
|
}
|