This commit is contained in:
2021-06-28 16:05:35 +08:00
parent b5bd2d12f8
commit a70e080153
+3 -2
View File
@@ -154,7 +154,7 @@ class Response extends HttpService
* @return bool * @return bool
* @throws Exception * @throws Exception
*/ */
public function send($context = '', $statusCode = 200): mixed public function send(string $context = '', int $statusCode = 200): mixed
{ {
$sendData = $this->parseData($context); $sendData = $this->parseData($context);
@@ -223,7 +223,8 @@ class Response extends HttpService
*/ */
private function sendData($response, $sendData, $status): void private function sendData($response, $sendData, $status): void
{ {
if (!Snowflake::getWebSocket()->exist($response->fd)) { $server = Snowflake::app()->getSwoole();
if (!$server->exist($response->fd) || $server->isEstablished($response->fd)) {
return; return;
} }
if (is_array($sendData)) { if (is_array($sendData)) {