From b29df878e73e7fdb85c85de5b34cd972d7699813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 30 Mar 2021 19:44:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Http/Response.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index e9cb2711..dc289229 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -295,6 +295,22 @@ class Response extends HttpService } + /** + * @param $clientId + * @param int $statusCode + * @param string $message + * @return mixed + */ + public function closeClient($clientId, $statusCode = 200, $message = ''): mixed + { + $socket = Snowflake::getWebSocket(); + if (!$socket->exist($clientId)) { + return true; + } + return $socket->close($clientId, true); + } + + /** * @param string $path * @param int $offset