-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error socket error when sending message larger that 200kb #133
Comments
Have you tested publishing a similar sized message to your broker using another MQTT client like the |
Thanks for getting back so soon. Testing with mosquitto_pub was succesful and worked. But i still get the socket error when using PhpMqtt. |
I've given this a short test and it seems that Lines 1138 to 1160 in 22a207e
The Nevertheless, I'll look into it as soon as possible. Maybe calling |
I think you're right. I checked the php documentation for See It might even be a drop in replacement for the current line: From: https://www.php.net/manual/en/function.fwrite.php. function fwrite_stream($fp, $string) {
for ($written = 0; $written < strlen($string); $written += $fwrite) {
$fwrite = fwrite($fp, substr($string, $written));
if ($fwrite === false) {
return $written;
}
}
return $written;
} |
I'm a bit skeptical about this solution due to this comment. I'm also not sure calling Line 293 in 22a207e
helps, but is not a viable option in my opinion. I'll try and see what other implications this has and maybe offer a configuration option for it. |
Good catch. A config option would be nice for solving this problem, however it would be great to be able to handle this dynamically. It is out of my expertise unfortunately. Thanks for giving a hint to where the issue arises (async). I might be able to create a temporary fix by extending the MqttClient class for my use case. |
I've been having a second look at this issue and I'm actually a bit smarter now, but unfortunately I still do not have a solution ready yet. We actually use Line 676 in 22a207e
And this would potentially mean that the client does not ping the broker in time, especially when no data is sent from the broker to the client regularly. The result would be a disconnect. If, however, you are not using the A second possible solution would be what you suggested, calling
So, to sum it all up: I'll need a bit more time to come up with a proper solution to this issue. 👍 |
@alysdal Thanks and sorry for the inconvenience, I'll release the fix immediately. |
Hi,
I'm trying to publish a 200 kb message to a topic, but i keep getting the socket error:
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:
Any ideas how i might accomplish this or how we could solve this?
The text was updated successfully, but these errors were encountered: