Skip to content

Commit 25438d6

Browse files
committed
Fix reconnect on connection reset
According to the official documentation `fwrite`() returns `false` when encountering an error. In order to detect whether the connection was reset we should therefore check for `false` and not `0`.
1 parent 3d53f8b commit 25438d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Wamp/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private function send($data, int $opcode = WebsocketPayload::OPCODE_TEXT): void
307307
);
308308

309309
// Check if the connection was reset, if so try to reconnect
310-
if (0 === @fwrite($this->socket, $encoded)) {
310+
if (false === @fwrite($this->socket, $encoded)) {
311311
$this->connected = false;
312312
$this->connect($this->target);
313313

0 commit comments

Comments
 (0)