diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index ac994f97..3d4683fb 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -77,6 +77,22 @@ class Request extends Application $this->fd = $fd; } + + /** + * @return array|null + * @throws ComponentException + */ + public function getConnectInfo(): array|null + { + if (empty($this->fd)) { + return null; + } + $server = Snowflake::app()->getSwoole(); + + return $server->connection_info($this->fd); + } + + /** * @return bool */