-->
Page 9 of 15

Re: esp_uMQTT_broker: A basic MQTT Broker on the ESP8266

PostPosted: Sat Sep 16, 2017 10:58 am
by walt22
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

Re: esp_uMQTT_broker: A basic MQTT Broker on the ESP8266

PostPosted: Sun Sep 17, 2017 3:58 am
by martin_g
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?).

Re: esp_uMQTT_broker: A basic MQTT Broker on the ESP8266

PostPosted: Sun Sep 17, 2017 3:59 am
by martin_g
BTW: Added some instructions on how to add the broker functionality to any ESP Arduino project. You can find it at the bottom of the README.md.

Re: esp_uMQTT_broker: A basic MQTT Broker on the ESP8266

PostPosted: Sun Sep 17, 2017 10:02 am
by walt22
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