Skip to content

Commit 359c5e2

Browse files
authored
Merge pull request #2 from Kekos/silent-sockets
Make writes to sockets silent with the @-operator to avoid PHP notices when the socket has been closed by the server.
2 parents 2c00807 + 7762bc4 commit 359c5e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MQTTClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ protected function writeToSocket(string $data, int $length = null): void
12961296

12971297
$length = min($length, strlen($data));
12981298

1299-
$result = fwrite($this->socket, $data, $length);
1299+
$result = @fwrite($this->socket, $data, $length);
13001300

13011301
if ($result === false || $result !== $length) {
13021302
$this->logger->error('Sending data over the socket to an MQTT broker failed.', [

0 commit comments

Comments
 (0)