huaweicloud-iot-device-sdk
Huawei IoT SDK MQTT client for Node.js
Installation
You can install it as dependency with npm.
$ # save into package.json dependencies with -S $ npm install huaweicloud-iot-device-sdk -S
Usage
Huawei IoT mqtt client with authrozied by deviceId & deviceSecret.
GET Data
const path = ;const huaweiIoT = ; const options = deviceId: "your deviceId" deviceSecret: "your deviceSecret" caFilePath: path host:'your iot host' //建立连接var client = huaweiIoT;clientclient var topic = `/huawei/v1/devices//data/json`var postJson = msgType: "deviceReq" data: serviceId: "pop" serviceData: stackId:4 client client
Subscribe Topic
client
Publish Message
clientclient
Receive Message
client