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

How to get MQTT status #30

Open
FernandoGarcia opened this issue Dec 14, 2016 · 5 comments
Open

How to get MQTT status #30

FernandoGarcia opened this issue Dec 14, 2016 · 5 comments

Comments

@FernandoGarcia
Copy link

FernandoGarcia commented Dec 14, 2016

Hi @tve !

Sorry by bother you again.

I would like to know if there any function to get MQTT status before try publish a message.

I'm using mqtt.connectedCb callback but it is not enough.

After an esp-link reset MQTT status is not updated I'm trying to solve this problem.

Best regards.

@tve
Copy link
Member

tve commented Dec 15, 2016

There is an mqtt Disconnected Callback that will tell you when the TCP connection dies. The Wifi status callback will tell you about the wifi association. There really isn't that much more info available...

@FernandoGarcia
Copy link
Author

FernandoGarcia commented Dec 15, 2016

Hi!

Disconnected callback is not called after an esp-link reset too.

It works rarely.

Best regards.

@tve
Copy link
Member

tve commented Dec 16, 2016

After an esp-link reset you get a reset callback... See https://github.com/jeelabs/el-client/blob/master/ELClient/ELClient.h#L119-L121
There are different cases and they require slightly different handling. It's not as simple as I wished it to be, but I don't see a way to make it simpler...
There is some high-level info here https://github.com/jeelabs/el-client/blob/master/ELClient/ELClient.h#L61-L77

@FernandoGarcia
Copy link
Author

Hi!

Thanks for your answer!

My solution was call this functions always before try publish something.

All callbacks are not working fine to me after a reset.

Best regards.

@FernandoGarcia
Copy link
Author

Hi!

A function to be used like this could be very interesting.

if (!MQTT.connected())

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants