-
Notifications
You must be signed in to change notification settings - Fork 400
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
Safe to publish callback? #12
Comments
now in mqttConnectCb function, you can publish a message |
This appears to be broken again with the latest version :( All I've done is insert MQTT_Publish(&mqttClient, "/test/topic", "Hello World 99", 14, 2, 0); at the end of the mqttConnectedCb, and the message never gets sent. ip:192.168.1.47,mask:255.255.255.0,gw:192.168.1.1 MQTT: Send keepalive packet to 192.168.1.147:1883! |
Any news on this, my project is on hold until this is fixed. Thanks. |
Hi,
Thanks for adding the callback for published data, which brings forward another issue.
The code I'm trying to implement is to send a temperature reading, then sleep for 15 minutes and repeat. The MQTT_Publish command will ignore any messages until the system is in a ready state (connState == MQTT_DATA) to be able to send messages.
Therefore I need to determine when it is safe to send a message before going to sleep. Looking at the code, the last callback appears to be the mqttConnectCb function. I tried adding my code to read the temperature sensor at the end of this callback, but the MQTT_Publish is ignored (I'm presuming the state is incorrect to send the message).
Is there a way / technique within the callback system to know when i can send a message?
Can the messages be queued to be sent?
Would another callback for readyToSend be practical?
The text was updated successfully, but these errors were encountered: