i-n-g-o / esp-mqtt-arduino

52 stars 28 forks source link

multiple subcribe #19

Open alex206cc opened 5 years ago

alex206cc commented 5 years ago

hi, sorry my english ... but how do I make multiple subscribers? moreover in case of user and password on the mqtt server how are they set?

thank you

i-n-g-o commented 5 years ago

you should be able to subscribe to many topics:

myMqtt.subscribe("topic1");
myMqtt.subscribe("topic2");
myMqtt.subscribe("topic2");

see example mqtt_sub

how you set user/password on the server probably differs from server to server... so you would need to look into how to do that with the mqtt-server you use.

hth.

alex206cc commented 5 years ago

not on server but on sketch... ;-) i'am use home assistant and with other library for mqtt the publish is ok but no the subscribe. with your library not function publish and subcribe.... can you halp me?

alex206cc commented 5 years ago

i found .setUserPwd ...

i-n-g-o commented 5 years ago

yes, you can user and password like that.

hard to say what is going wrong with publish ans subscribe.