diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index 30a28f55..569f18e3 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -228,6 +228,7 @@ class Request extends HttpService return current($this->explode); } + /** * @return string */ @@ -237,18 +238,6 @@ class Request extends HttpService } - /** - * @return mixed - * @throws Exception - */ - public function adapter(): void - { - if (!$this->isHead()) { - router()->dispatch(); - } - } - - /** * @return string|null */ diff --git a/Server/ServerManager.php b/Server/ServerManager.php index 5f5c3bfd..6f159b16 100644 --- a/Server/ServerManager.php +++ b/Server/ServerManager.php @@ -337,14 +337,13 @@ class ServerManager extends Abstracts\Server $reflect = $this->getNewInstance(WebSocketServerListener::class); $this->server->on('handshake', [$reflect, 'onHandshake']); $this->server->on('message', [$reflect, 'onMessage']); - $this->server->on('close', [$reflect, 'onClose']); - $this->server->on('disconnect', [$reflect, 'onDisconnect']); + $this->server->on('connect', [$reflect, 'onConnect']); $reflect->setEvents(Constant::HANDSHAKE, $settings['events'][Constant::HANDSHAKE] ?? null); - $reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? null); $reflect->setEvents(Constant::MESSAGE, $settings['events'][Constant::MESSAGE] ?? null); $reflect->setEvents(Constant::CONNECT, $settings['events'][Constant::CONNECT] ?? null); - $reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null); + + $this->addCloseOrDisconnect($reflect, $settings); } else if ($type === Constant::SERVER_TYPE_UDP) { $reflect = $this->getNewInstance(UDPServerListener::class); $this->server->on('packet', [$reflect, 'onPacket']);