Skip to content

WebSocket.php error in loop() #20

@AndeYashwanth

Description

@AndeYashwanth

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());

https://github.com/heminei/php-websocket/blob/master/src/HemiFrame/Lib/WebSocket/WebSocket.php#L455-L461

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions