Left here for archival purposes.

User avatar
By Andrey Andrev
#40337 Hi, I am trying to connect my local mosquitto server using mqtt lib and following code provides no output at all:

Code: Select allm=mqtt.Client("nodemcu_box", 120)

m:connect("192.168.1.3", 1883, 0, function(conn)
    print("connected")
end)

m:publish("hello/world","hello from nodemcu",0,0, function(conn)
    print("sent")
end)


but I can send messages to the broker using console client

Code: Select all$ mosquitto_pub -h 192.168.1.3 -p 1883 -d -t hello/world -m "hello"


and receive it if I subscribe to topic.

What might be the reason why it is not working from nodemcu?
User avatar
By Viriato
#41213 Hi,
I have the same issue , did you found a solution ?
My setup is the following :
- I am using Pi 2 as a broker , with mosquito installed
- client on PC - work correctly both ways
- client on Android - work correctly both ways

But Can't connect with ESP8266 - firmware 0.9.6
Any suggestion on this issue ?

Thanks