2020-09-02 11:38:47 +08:00
|
|
|
<?php
|
2020-10-29 18:17:25 +08:00
|
|
|
declare(strict_types=1);
|
2020-09-02 11:38:47 +08:00
|
|
|
|
|
|
|
|
namespace HttpServer\Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use HttpServer\Service\Abstracts\Tcp;
|
|
|
|
|
use ReflectionException;
|
2021-08-11 01:04:57 +08:00
|
|
|
use Kiri\Exception\NotFindClassException;
|
2020-09-02 11:38:47 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class OnPacket
|
|
|
|
|
* @package HttpServer\Events
|
|
|
|
|
*/
|
|
|
|
|
class Packet extends Tcp
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws ReflectionException
|
|
|
|
|
* @throws NotFindClassException
|
|
|
|
|
*/
|
|
|
|
|
public function onInit()
|
|
|
|
|
{
|
|
|
|
|
$this->onHandlerListener();
|
|
|
|
|
$this->onBaseListener();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws NotFindClassException
|
|
|
|
|
* @throws ReflectionException
|
|
|
|
|
*/
|
|
|
|
|
public function onBaseListener()
|
|
|
|
|
{
|
|
|
|
|
$this->on('packet', $this->createHandler('packet'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|