Files
kiri-core/http-server/Constrict/UdpEmitter.php
T

32 lines
586 B
PHP
Raw Normal View History

2021-08-12 15:07:12 +08:00
<?php
namespace Server\Constrict;
use Kiri\Exception\NotFindClassException;
2021-08-28 01:25:24 +08:00
use Psr\Http\Message\ResponseInterface;
2021-08-12 15:07:12 +08:00
use Swoole\Server;
/**
*
*/
class UdpEmitter implements Emitter
{
/**
* @param Server $response
* @param ResponseInterface $emitter
* @throws NotFindClassException
* @throws \ReflectionException
* @throws \Exception
*/
2021-08-12 15:08:46 +08:00
public function sender(mixed $response, ResponseInterface $emitter): void
2021-08-12 15:07:12 +08:00
{
$clientInfo = $emitter->getClientInfo();
$response->sendto($clientInfo['host'], $clientInfo['port'],
$emitter->getContent()->getData()
);
}
}