Foreword
This section look at the implementation MQTT communication on Ali cloud is a kind of process
In fact, I do not have a very long tutorial how things connect ready-made platform,
Has been written to teach you to build their own server, the main reason is because I feel connected to the existing learn anything.
Now out of this tutorial, because really found a lot of people like to use.
But you look at it! Connect the existing very simple
In fact, I do not understand is: This online tutorial !!!! everywhere and the price is set high, just like the same as on how tall ......
Things search platform (if not open yourself open)
Creating Products
Note: Here is a look at their own in that area, will be used later
Now I need to know how to connect the device
Anyway MQTT, and then how to get, but also MQTT, then how do it that several parameters .......
I just need to know the user name, password, IP address, port number, ClientID what it is
https://help.aliyun.com/document_detail/86706.html Ali cloud documentation
MQTT: IP address
{
"ProductKey": "a1m7er1nJbQ",
"DeviceName": "Mqtt",
"DeviceSecret": "7GUrQwgDUcXWV3EIuLwdEvmRPWcl7VsU"
}
${YourProductKey}.iot-as-mqtt.${region}.aliyuncs.com
The final IP address:
a1m7er1nJbQ.iot-as-mqtt.cn-shanghai.aliyuncs.com
MQTT: port number 1883
MQTT: Client ID
{
"ProductKey": "a1m7er1nJbQ",
"DeviceName": "Mqtt",
"DeviceSecret": "7GUrQwgDUcXWV3EIuLwdEvmRPWcl7VsU"
}
1.我就规定我的clientId是 112233445566 这节是简单的测试哈,后期咱Wi-Fi连接的时候用Wi-Fi的MAC
GPRS 连接的时候咱用GPRS的IMEI
2.咱呢先不走SSL,否则芯片还需要设置成SSL连接 所以 securemode=3
3.最后一个呢,咱就选用 hmacsha1
最终Client ID:
112233445566|securemode=3,signmethod=hmacsha1|
MQTT: 用户名
{
"ProductKey": "a1m7er1nJbQ",
"DeviceName": "Mqtt",
"DeviceSecret": "7GUrQwgDUcXWV3EIuLwdEvmRPWcl7VsU"
}
最终用户名:
Mqtt&a1m7er1nJbQ
MQTT: 密码
{
"ProductKey": "a1m7er1nJbQ",
"DeviceName": "Mqtt",
"DeviceSecret": "7GUrQwgDUcXWV3EIuLwdEvmRPWcl7VsU"
}
第一种 用提供的软件组合计算
所以MQTT连接的密码
8B286A9E99B49E19A0964589E8F3C2DBB1C1A8DE
最终:
IP地址: a1m7er1nJbQ.iot-as-mqtt.cn-shanghai.aliyuncs.com
端口号: 1883
Client ID: 112233445566|securemode=3,signmethod=hmacsha1|
用户名: Mqtt&a1m7er1nJbQ
密码: 8B286A9E99B49E19A0964589E8F3C2DBB1C1A8DE
然后测试