From 6362c7f5eae0718fed709c53e9d275242927b07a Mon Sep 17 00:00:00 2001 From: whwyy Date: Thu, 26 Feb 2026 14:44:26 +0800 Subject: [PATCH] eee --- core/Websocket.php | 16 ++++++---------- test.php | 9 +++------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/core/Websocket.php b/core/Websocket.php index 858f1fe..9a336d9 100644 --- a/core/Websocket.php +++ b/core/Websocket.php @@ -2,14 +2,10 @@ namespace Coroutine\Server; -use Closure; -use Kiri\Di\Context; use Kiri\Di\Inject\Container; use Kiri\Router\Constrict\ConstrictRequest; -use Kiri\Router\Constrict\ConstrictResponse; use Kiri\Server\Contract\OnDisconnectInterface; use Kiri\Server\Contract\OnMessageInterface; -use Psr\Http\Message\ResponseInterface; use Swoole\Coroutine; use Swoole\Coroutine\Http\Server; use Swoole\Http\Request; @@ -49,12 +45,6 @@ abstract class Websocket implements OnMessageInterface, OnDisconnectInterface } - /** - * @return void - */ - abstract public function clearAllOnlineUsers(): void; - - /** * @return void */ @@ -124,6 +114,12 @@ abstract class Websocket implements OnMessageInterface, OnDisconnectInterface } + /** + * @return void + */ + abstract public function clearAllOnlineUsers(): void; + + /** * @param ConstrictRequest $request * @return bool diff --git a/test.php b/test.php index ed6af5a..b51a6bf 100644 --- a/test.php +++ b/test.php @@ -24,7 +24,6 @@ class Test extends Websocket { // TODO: Implement onConnected() method. $this->stateChange($request->getAuthority()->getUniqueId(), 1); - return true; } @@ -47,12 +46,10 @@ class Test extends Websocket $client->close(); if ($client->getStatusCode() != 200) { return false; + } else { + $request->withAuthority(json_decode($client->body)); + return true; } - - $data = json_decode($client->body, true); - - $request->withAuthority($data); - return true; } /**