lua - Cannot connect to MQTT broker from ESP8266 -


i have installed mosquitto on windows machine , it's mqtt v3.1 broker (downloaded mosquitto.org).

i trying connect broker esp8266 , far have not been able connect broker. can connect public broker, not broker installed on machine connected same wifi network.

i have built firmware using build-nodemcu service , used master branch. think has mqtt v3.1.1.

i came across question , guess have ran same situation. though cause of issue has been given, how rid of problem has not been mentioned there.

can please suggest how rid of problem?

update [13-09-2016]
here code using:

sensorid = "sen_001" tgthost = "192.168.8.101" tgtport = "1883" mqttuserid = "admin" mqttpass = "word" mqtttimeout = 120 topicqueue = "/security"  wifi_ssid = "lakmal 4g" wifi_password = "tf18bny3m" wifi_signal_mode = wifi.phymode_n  esp8266_ip="" esp8266_netmask="" esp8266_gateway=""  if wifi.sta.getip() == nil     wifi.setmode(wifi.station)      wifi.setphymode(wifi_signal_mode)     wifi.sta.config(wifi_ssid, wifi_password)      wifi.sta.connect() end  if esp8266_ip ~= ""     wifi.sta.setip({ip=esp8266_ip,netmask=esp8266_netmask,gateway=esp8266_gateway}) end  print("ip: " .. wifi.sta.getip())  m = mqtt.client(sensorid, mqtttimeout, mqttuserid, mqttpass, 1) m:lwt("/lwt", "offline", 0, 0) m:on("connect", function(client) print ("connected") end) m:on("offline", function(client) print ("offline") end) m:on("message", function(client, topic, data)          print(topic .. ":" )          if data ~= nil             print(data)         end     end)  m:connect(tgthost, tgtport, 0, function(client) print ("connected") end,                                     function(client, reason) print("failed reason: "..reason) end) 

i "failed reason: -5" error.

i tested broker mqttlens chrome extension , broker works nicely.

sorry, long comment.

both nodemcu mqtt docs , so question referenced make clear need mqtt 3.1.1, 3.1 won't suffice.

the mosquitto website states that

eclipse mosquitto™ open source (epl/edl licensed) message broker implements mqtt protocol versions 3.1 , 3.1.1.

yet, claim broker 3.1 sounds not whole truth in light of above statement.

i'll update answer if update question more details. have given neither code nor error messages. fact nodemcu/lua code works fine public brokers pretty strong case against local broker, though.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -