diff --git a/Client/Client.php b/Client/Client.php index a15281f..d1a6e56 100644 --- a/Client/Client.php +++ b/Client/Client.php @@ -7,7 +7,7 @@ /** * @author Pierre Rolland */ -class Client +class Client implements ClientInterface { /** @var ConnectionInterface */ protected $connection; diff --git a/Client/ClientStack.php b/Client/ClientStack.php index 7477f1e..988544b 100644 --- a/Client/ClientStack.php +++ b/Client/ClientStack.php @@ -28,6 +28,11 @@ public function removeClient(ConnectionInterface $connection) unset($this->clients[$this->getClientIndex($connection)]); } + public function getClients(): array + { + return $this->clients; + } + private function getClientIndex(ConnectionInterface $connection): int { foreach ($this->clients as $i => $c) { diff --git a/Websocket.php b/Websocket.php index b7607aa..a98586e 100644 --- a/Websocket.php +++ b/Websocket.php @@ -30,7 +30,7 @@ public function __construct(HandlerRegistry $handlerRegistry, string $clientClas public function onOpen(ConnectionInterface $conn) { - $this->clientStack->addClient(new ${$this->clientClass}($conn)); + $this->clientStack->addClient(new $this->clientClass($conn)); } public function onMessage(ConnectionInterface $from, $msg)