Can not connect to MQTT hub
Posted: Wed Feb 03, 2016 5:12 am
Hi, I am trying to connect my local mosquitto server using mqtt lib and following code provides no output at all:
but I can send messages to the broker using console client
and receive it if I subscribe to topic.
What might be the reason why it is not working from nodemcu?
Code: Select all
m=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?