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

[MQTT] Fix change in client.connected() behavior for pubsubclient #2811

Merged
merged 2 commits into from
Dec 11, 2019

Conversation

TD-er
Copy link
Member

@TD-er TD-er commented Dec 11, 2019

See this issue where the changes in behavior for wificlient.connected() is discussed: esp8266/Arduino#6701

A change dating back to April 2018 ( esp8266/Arduino#4626 ) does have some implications on how to interpret the client.connected() result.
It is very well possible there is still data in the buffers waiting to be read.
So the loop() function of pubsubclient should first try to empty the received data and then decide what to do with the connected state.

So reading is fine, if there is data available, but writing needs an extra check.

Use of connection failure threshold is now also trying to disconnect/reconnect a number of times before reboot.

See this issue where the changes in behavior for wificlient.connected() is discussed: esp8266/Arduino#6701

A change dating back to April 2018 ( esp8266/Arduino#4626 ) does have some implications on how to interpret the client.connected() result.
It is very well possible there is still data in the buffers waiting to be read.
So the loop() function of pubsubclient should first try to empty the received data and then decide what to do with the connected state.

So reading is fine, if there is data available, but writing needs an extra check.
Use of  connection failure threshold is now also trying to disconnect/reconnect a number of times before reboot.
@TD-er TD-er merged commit 345cf2b into letscontrolit:mega Dec 11, 2019
@TD-er TD-er deleted the bugfix/pubsubclient_connected branch December 11, 2019 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant