Skip to content
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

Add connection setting for blocking mode of socket #135

Merged
merged 2 commits into from
Dec 9, 2022

Conversation

Namoshek
Copy link
Collaborator

@Namoshek Namoshek commented Dec 9, 2022

In #133 has been shown that sending large messages (e.g. binaries with a few hundred or thousand kilo bytes) does not work reliably and sometimes only the partial message is sent, leaving the receiver with a broken message. The source of the issue has been found in the stream_set_blocking($socket, false) call in the MqttClient class.

This PR therefore adds a connection setting for the blocking mode of the socket. It is recommended to leave this setting with the default, but in some rare scenarios it may be useful to not use a non-blocking but a blocking socket. The primary use case is when publishing large messages without using the MqttClient::loop() method.

@Namoshek Namoshek added the bug Something isn't working label Dec 9, 2022
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@Namoshek Namoshek merged commit 846f0de into master Dec 9, 2022
@Namoshek Namoshek deleted the fix/#133-send-data-larger-than-send-buffer branch December 9, 2022 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant