Просмотр исходного кода

update script/libs/aliyun.lua.
由于旧版本的阿里云MQTT并不能通过InstanceId..mqtt.iothub.aliyuncs.com连接上,必须通过ProductKey..iot-as-mqtt.cn-shanghai.aliyuncs.com才能连接上阿里云,增加自定义host

Signed-off-by: 杨肖绕 <5415104+okook@user.noreply.gitee.com>

杨肖绕 2 лет назад
Родитель
Сommit
4c48f719f4
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      script/libs/aliyun.lua

+ 1 - 1
script/libs/aliyun.lua

@@ -238,7 +238,7 @@ tPara[mqtt_port] ,mqtt端口
 tPara[mqtt_isssl] ,是否使用ssl加密连接,true为无证书最简单的加密
 ]]
 function aliyun.setup(tPara)
-    mqtt_host = tPara.InstanceId..".mqtt.iothub.aliyuncs.com"
+    mqtt_host = tPara.host or tPara.InstanceId..".mqtt.iothub.aliyuncs.com"
     if tPara.ProductSecret == "" or tPara.ProductSecret == nil then
         confiDentialTask(tPara.DeviceName,tPara.ProductKey,tPara.DeviceSecret,mqtt_host,tPara.mqtt_port,tPara.mqtt_isssl)
     else