In loop() method in WebSockets.php the client is disconnected when the max clients are reached. So if the client is disconnected and socket is closed, $this->read($client->getSocket()) will give an error as the socket is not valid anymore(as it is closed).
if (count($this->clients) >= $this->maxClients) {
$this->log("Max clients limit reached", $client);
$this->log("Client is disconnected", $client);
$this->disconnectClient($client, self::STATUS_CLOSE_PROTOCOL_ERROR, "Max clients limit reached");
}
$buf = $this->read($client->getSocket());
In loop() method in WebSockets.php the client is disconnected when the max clients are reached. So if the client is disconnected and socket is closed, $this->read($client->getSocket()) will give an error as the socket is not valid anymore(as it is closed).
https://github.com/heminei/php-websocket/blob/master/src/HemiFrame/Lib/WebSocket/WebSocket.php#L455-L461