@iotize/device-com-mqtt.js
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

IoTize Device Com MQTT

Installation

Browser

Download latest version or use this link to load from jsdeliver.

<script src="https://cdn.jsdelivr.net/npm/@iotize/device-com-mqtt.js@latest/dist/iotize-device-com-mqtt.min.js" />

npm

npm install @iotize/device-com-mqtt.js

Usage

// 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.

Dependents (2)

Package Sidebar

Install

npm i @iotize/device-com-mqtt.js

Weekly Downloads

6

Version

2.3.0

License

MIT

Unpacked Size

666 kB

Total Files

117

Last publish

Collaborators

  • stephane.leonard
  • iotize-dev
  • stephane.leonard.iotize
  • behnaz.bouchiat
  • gvercasson