lua - NodeMCU fails to connect to Bluemix with TLS -
i try connect nodemcu ibm bluemix iot foundation. unsecured mqtt connect works splendid , pushes data bmp180 cloud. however, when start using tls won't connect broker. tried make tls connection mqtt.fx , works fine, seems nodemcu problem. if run code:
orgid="****" broker = orgid..".<bluemix>" brport = 8883 clientid = "d:"..orgid..":generic_esp:generic_esp_01" print("clientid: "..clientid) brpwd = "***********" bruser = "use-token-auth" local function publish() dofile('sensor.lc') m:publish('iot-2/evt/esp8266/fmt/json',payload,1,0, function(conn) print('payload published') end) end m = mqtt.client(clientid, 120, bruser, brpwd) c = false print('mqtt init') m:on('offline', function(con) print('mqtt offline'); c = false end) m:connect(broker, brport, 1, function(conn) print('mqtt connected: '..broker..':'..brport) c = true publish() end) tmr.alarm(1, 1000, 1, function() if not c print('mqtt reconnecting') m:close() c = false m:connect(broker, brport, 1, function(conn) print('.. mqtt reconnected: '..broker..':'..brport); c = true end) end if c publish() end end)
the esp8266 prints "mqtt reconnecting" , can't connect. wrong code or tls not supported in nodemcu 1.4, yet?
i've captured client hello in 1 of our test stands:
0000 16 03 02 00 33 01 00 00 2f 03 02 00 00 00 00 d0 0010 b1 a1 3a 07 1c 1b 3e f2 fc 03 91 d6 18 b5 ae 5d 0020 77 65 37 f5 07 10 45 d1 7e 1a ea 00 00 08 00 2f 0030 00 35 00 05 00 04 01 00
this looks tls v1.1 client hello. client hello "best" can , negotiated downwards. in case iotf close connection because supports tls 1.2. please can check device setup tls 1.2 ?
Comments
Post a Comment