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 ReflectionException;
|
|
|
|
|
use Snowflake\Exception\NotFindClassException;
|
|
|
|
|
use HttpServer\Service\Abstracts\Websocket as HAWebsocket;
|
|
|
|
|
|
|
|
|
|
class Websocket extends HAWebsocket
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws ReflectionException
|
|
|
|
|
* @throws NotFindClassException
|
|
|
|
|
*/
|
|
|
|
|
public function onInit()
|
|
|
|
|
{
|
|
|
|
|
$this->onHandlerListener();
|
|
|
|
|
$this->onBaseListener();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws NotFindClassException
|
|
|
|
|
* @throws ReflectionException
|
|
|
|
|
*/
|
|
|
|
|
public function onBaseListener()
|
|
|
|
|
{
|
|
|
|
|
$this->on('handshake', $this->createHandler('handshake'));
|
|
|
|
|
$this->on('message', $this->createHandler('message'));
|
|
|
|
|
$this->on('close', $this->createHandler('close'));
|
2021-07-11 04:27:56 +08:00
|
|
|
|
|
|
|
|
var_dump($this->getCallback('close'));
|
2020-09-02 11:38:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|