iot-device-mqtt-sdk

0.0.3 • Public • Published

iot-mqtt-sdk

Installation

You can install it as dependency with npm.

$ # save into package.json dependencies with -S
$ npm install iot-mqtt-sdk -S

Aliyun

Aliyun IoT Hub mqtt client with authrozied by productKey & deviceName & deviceSecret & host.

const Mqtt = require('iot-device-mqtt-sdk');

const client = Mqtt.getIoTClient({
    productKey: "",
    deviceName: "",
    deviceSecret: "",
    host: "",
});


client.on('connect', function() {
    console.log("connect")
})

client.end(function (){
    console.log("end")
})

Huawei Cloud

Huawei Cloud IoT Hub mqtt client with authrozied by deviceName & deviceSecret & host.

const Mqtt = require('iot-device-mqtt-sdk');

const client = Mqtt.getIoTClient({
    deviceName: "",
    deviceSecret: "",
    host: "",
});


client.on('connect', function() {
    console.log("connect")
})

client.end(function (){
    console.log("end")
})

Tencent Cloud

Tencent Cloud IoT Hub mqtt client with authrozied by productKey & deviceName & deviceSecret & host.

const Mqtt = require('iot-device-mqtt-sdk');

const client = Mqtt.getIoTClient({
    productKey: "",
    deviceName: "",
    deviceSecret: "",
    host: "",
});


client.on('connect', function() {
    console.log("connect")
})

client.end(function (){
    console.log("end")
})

OneNET

OneNET IoT Hub mqtt client with authrozied by productKey & deviceName & deviceSecret & host.

const Mqtt = require('iot-device-mqtt-sdk');

const client = Mqtt.getIoTClient({
    productKey: "",
    deviceName: "",
    deviceSecret: "",
    host: "",
});


client.on('connect', function() {
    console.log("connect")
})

client.end(function (){
    console.log("end")
})

CTWing

CTWing IoT Hub mqtt client with authrozied by deviceName & deviceSecret & host.

const Mqtt = require('iot-device-mqtt-sdk');

const client = Mqtt.getIoTClient({
    deviceName: "",
    deviceSecret: "",
    host: "",
});


client.on('connect', function() {
    console.log("connect")
})

client.end(function (){
    console.log("end")
})

Subscribe Topic

client.subscribe(topic)

Publish Message

client.publish(topic, 'Hello mqtt')
client.publish(topic, 'Hello mqtt', { qos: 1 })

Receive Message

client.on('message', function(topic, message) {
    console.log(topic+"," + message.toString())
})

Package Sidebar

Install

npm i iot-device-mqtt-sdk

Weekly Downloads

12

Version

0.0.3

License

MIT

Unpacked Size

13.6 kB

Total Files

6

Last publish

Collaborators

  • wongxming