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 mikehedi
#71575
martin_g wrote:Walter, thank for these measurements - I haven't done any performance tests so far, just functional tests, so this is a valuable info!

For those of you, that don't like the NONOS SDK, I now added the local client calls to the Arduino API, i.e. with
Code: Select allbool MQTT_local_publish(uint8_t* topic, uint8_t* data, uint16_t data_length, uint8_t qos, uint8_t retain);
bool MQTT_local_subscribe(uint8_t* topic, uint8_t qos);
bool MQTT_local_unsubscribe(uint8_t* topic);

void MQTT_server_onData(MqttDataCallback dataCb);
void MQTT_server_onAuth(MqttAuthCallback authCb);

you can now locally interact with the broker from your sketch without the need of TCP connection or an additional pubsub-library. Detail can be found here https://github.com/martin-ger/esp_mqtt#using-the-esp_umqtt_broker-in-an-arduino-project

Dear Martin ,
Thank you very much for this valuable work ,
As you know the most important part of IOT is its security ,

My question is about MQTT username and password and SSL connection to esp-broker ,

I'm using Arduino source code and I didn't get how to add a username and password in the ESP broker and connect to it using MQTT-Client ,
I will appreciate if you add an example about adding username and password in the sketch and use it on mqtt-client ,

Regards , Mike
User avatar
By mikehedi
#71576
martin_g wrote:Walter, thank for these measurements - I haven't done any performance tests so far, just functional tests, so this is a valuable info!

For those of you, that don't like the NONOS SDK, I now added the local client calls to the Arduino API, i.e. with
Code: Select allbool MQTT_local_publish(uint8_t* topic, uint8_t* data, uint16_t data_length, uint8_t qos, uint8_t retain);
bool MQTT_local_subscribe(uint8_t* topic, uint8_t qos);
bool MQTT_local_unsubscribe(uint8_t* topic);

void MQTT_server_onData(MqttDataCallback dataCb);
void MQTT_server_onAuth(MqttAuthCallback authCb);

you can now locally interact with the broker from your sketch without the need of TCP connection or an additional pubsub-library. Detail can be found here https://github.com/martin-ger/esp_mqtt#using-the-esp_umqtt_broker-in-an-arduino-project


Dear Martin ,
Thank you very much for this valuable work ,
As you know the most important part of IOT is its security ,

My question is about MQTT username and password and SSL connection to esp-broker ,

I'm using Arduino source code and I didn't get how to add a username and password in the ESP broker and connect to it using MQTT-Client ,
I will appreciate if you add an example about adding username and password in the sketch and use it on mqtt-client ,

Regards , Mike
User avatar
By martin_g
#71666 Find an example for username/password here: https://github.com/martin-ger/esp_mqtt/issues/10#issuecomment-339541258

This works fine now and in the callback you can handle any u/p combination from your own database.

Up to now, the ESP8266 cannot work reasonable (for more than one client) as TLS server due to memory constraints.

I think, the security model is as follows: local direct LWAN-connections to your own devices are protected by the WiFi -WPA2. Anything to the Internet is send over one SSL-MQTT client or HTTPS client connection to a well known cloud service. I would not recommend to offer sever access to the ESP from the Internet, neither my to my esp_uMQTT_broker nor any other ESP software. lwip and TLS on the ESP are not robust enough to fight with all the bad guys out there.
User avatar
By martin_g
#71844 As I realized that most of you are using the lib in the Arduino environment I have moved the pure library into a separate repository: https://github.com/martin-ger/uMQTTBroker

From here you can easily integrate it directly into the Arduino shell. Just clone (or download the zip-file and extract) the sources cleanly into the libraries directory of the Arduino ESP8266 installation (no more separate SDK compilation or lib copying is required).

Up to now the API is still plain C and the included client functionality is not yet offered, but I am working on that...