mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
46 lines
789 B
PHP
46 lines
789 B
PHP
<?php
|
|
|
|
namespace App\Server\Connections;
|
|
|
|
use Ratchet\ConnectionInterface;
|
|
use React\Socket\ConnectionInterface as ReactConn;
|
|
|
|
class IoConnection implements ConnectionInterface {
|
|
/**
|
|
* @var \React\Socket\ConnectionInterface
|
|
*/
|
|
protected $conn;
|
|
|
|
|
|
/**
|
|
* @param \React\Socket\ConnectionInterface $conn
|
|
*/
|
|
public function __construct(ReactConn $conn) {
|
|
$this->conn = $conn;
|
|
}
|
|
|
|
/**
|
|
* @return ReactConn
|
|
*/
|
|
public function getConnection(): ReactConn
|
|
{
|
|
return $this->conn;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function send($data) {
|
|
$this->conn->write($data);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function close() {
|
|
$this->conn->end();
|
|
}
|
|
}
|