-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
I'm trying to publish a 200 kb message to a topic, but i keep getting the socket error:
PhpMqtt\Client\Exceptions\DataTransferException
[65] Transferring data over socket failed: Sending data over the socket failed. Has it been closed?
at vendor/php-mqtt/client/src/MqttClient.php:1147
1143▕ $result = @fwrite($this->socket, $data, $length);
1144▕
1145▕ if ($result === false || $result !== $length) {
1146▕ $this->logger->error('Sending data over the socket to the broker failed.');
➜ 1147▕ throw new DataTransferException(
1148▕ DataTransferException::EXCEPTION_TX_DATA,
1149▕ 'Sending data over the socket failed. Has it been closed?'
1150▕ );
1151▕ }
Splitting the message is not an option as this is used in an OTA update for a device that expects a single binary message.
Here is a code example to reproduce the issue:
$mqtt = new \PhpMqtt\Client\MqttClient('test.mosquitto.org', '1883');
// Create and configure the connection settings as required.
$connectionSettings = (new ConnectionSettings)
->setUsername(null)
->setPassword(null);
$mqtt->connect($connectionSettings, true);
$count = 1000*200; // 200 kilobytes
$mqtt->publish("topic", str_repeat('-', $count));
Any ideas how i might accomplish this or how we could solve this?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working