IoTize Device Communication protocol for MQTT
Download latest version or use this link to load from jsdeliver.
``html`
`bash`
npm install @iotize/device-com-mqtt.js
`javascript
// Library name: IoTizeDeviceComMqtt
// Simple mqtt protocol
import { connect as mqttConnect, IClientOptions, MqttClient } from "mqtt";
let mqttProtocol = IoTizeDeviceComMqtt.MqttProtocol();
// Mqtt protocol for IoTize relay
let mqttRelayProtocol = IoTizeDeviceComMqtt.createClientMQTTRelayProtocol({
connect: (brokerUrl?: string | any, options?: IClientOptions): MqttClient => {
return mqttConnect(brokerUrl, options);
},
serialNumber: "your serial number",
netkey: "testnetkey",
broker: {
username: "broker username",
password: "broker password",
url: "ws://user.cloud.iotize.com:9001",
},
});
``
For more informations, read the documentation.