Left here for archival purposes.

User avatar
By rlettow
#44221 I am encountering a strange problem when publishing multiple MQTT messages. I was expecting that each function would callback for each unique message published but this was not the case. Is it a bug or are my expectations or code wrong? Maybe worth noting that the subscribe function callback performs the same way as this. Thank you in advance. -Rick

m:publish("/topic1/data","foo",1,0,function(client) print("published topic 1") end)
m:publish("/topic2/data","foo",1,0,function(client) print("published topic 2") end)
m:publish("/topic3/data","foo",1,0,function(client) print("published topic 3") end)

published topic 3
published topic 3
published topic 3

NodeMCU custom build by frightanic.com
branch: master
commit: c8037568571edb5c568c2f8231e4f8ce0683b883
SSL: true
modules: dht,file,gpio,mqtt,net,node,tmr,uart,wifi
build built on: 2016-03-26 14:25
powered by Lua 5.1.4 on SDK 1.4.0

UPDATE: April 2, 2016
Documented as an issue on https://github.com/nodemcu/nodemcu-firmware/issues/1217
Documentation updated to indicate the behavior.