diff --git a/src/Internal/Rfc6455Client.php b/src/Internal/Rfc6455Client.php index 45566d3..1ed7f1c 100644 --- a/src/Internal/Rfc6455Client.php +++ b/src/Internal/Rfc6455Client.php @@ -34,6 +34,7 @@ class Rfc6455Client public $compressionContext; // getInfo() properties + public $remoteAddress; public $connectedAt; public $closedAt = 0; public $closeCode; diff --git a/src/Internal/Rfc6455Gateway.php b/src/Internal/Rfc6455Gateway.php index 2fbf6c2..977be36 100644 --- a/src/Internal/Rfc6455Gateway.php +++ b/src/Internal/Rfc6455Gateway.php @@ -227,6 +227,7 @@ public function reapClient( $client->capacity = $this->maxBytesPerMinute; $client->connectedAt = $this->now; $client->id = (int) $socket->getResource(); + $client->remoteAddress = $socket->getRemoteAddress(); $client->socket = $socket; $client->compressionContext = $compressionContext; @@ -925,6 +926,7 @@ public function getInfo(int $clientId): array $client = $this->clients[$clientId]; return [ + 'remote_address' => $client->remoteAddress, 'bytes_read' => $client->bytesRead, 'bytes_sent' => $client->bytesSent, 'frames_read' => $client->framesRead, diff --git a/src/Websocket.php b/src/Websocket.php index bb0de34..2f040fb 100644 --- a/src/Websocket.php +++ b/src/Websocket.php @@ -161,6 +161,7 @@ final public function close(int $clientId, int $code = Code::NORMAL_CLOSE, strin * @param int $clientId * * @return array [ + * 'remote_address' => string|null, * 'bytes_read' => int, * 'bytes_sent' => int, * 'frames_read' => int,