Added method to access request from connection

This commit is contained in:
Chris 2024-02-22 16:24:49 +01:00
parent 1c9d8a4a05
commit 2cf95fcc85
2 changed files with 7 additions and 0 deletions

View File

@ -165,6 +165,11 @@ class WebSocketConnection implements WebSocketInterface
return $this->group; return $this->group;
} }
public function getServerRequest(): ServerRequestInterface
{
return $this->request;
}
public function getRemoteAddress() public function getRemoteAddress()
{ {
return $this->request->getServerParams()['REMOTE_ADDR']; return $this->request->getServerParams()['REMOTE_ADDR'];

View File

@ -25,4 +25,6 @@ interface WebSocketInterface extends ConnectionInterface
public function closeWithReason(string $reason, int $code=1000); public function closeWithReason(string $reason, int $code=1000);
public function getServerRequest(): ServerRequestInterface;
} }