A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By walt22
#70033 Hello Martin,

Your broker works very fine. I am able to pub and sub from an external device with good response times.
Now I want to communicate from the ESP broker device to an external one, but I fail.
Within a small user routine the following statements are performed:

retval = MQTT_Publish(&mqttClient, "/test", "Hallo", 5, 0, 0);
if(retval)
os_printf(">>> retval OK\r\n");
The pub routine returns true, but the mqttPublishedCb is not triggered.
Any hint what I did wrong?

Many thanks, Walter
User avatar
By martin_g
#70042 The client functionality of the mqtt-lib is unchanged from tuanpmt's code. Does it work with his lib? Do you see any publications, when you connect to the broker with a debug client? What kind of external broker you use? Mosquitto or an instance of the esp_uMQTT_broker (if so, what does "show mqtt" print?).
User avatar
By walt22
#70055 Hello Martin,

Thanks of your hint about the Arduino stuff, I have discovered the local MQTT functions. So with
retval = MQTT_local_publish( "/test", "Hallo", 5, 0, 0);
the messages went successfully to my external MQTT client (mosquitto_sub) on my PC.
Now I try the other way around in order to receive pubs from the PC by
retval = MQTT_local_subscribe("/test", 0);

According to my understanding these messages should appear in MQTT_server_onData().
But this seems to be wrong, nothing happens here.
So what is the proper method in order to receive pubs from an external MQTT client?
Is it possible to receive the local pubs as well?

Following my show mqtt:
Current clients:
mosqsub/1932-wib-PC
Current subsriptions:
mosqsub/1932-wib-PC: "/test" (QoS 0)
local: "/test" (QoS 0)
Retained topics:
MQTT client disconnected
Script disabled

Again many thanks for your support
Walter