0.1.7 • Published 6 years ago

mutator-io-plugin-in-mqtt v0.1.7

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

MQTT input stream

NPM version

MQTT input stream provides an easy wrapper around MQTT.js for mutator-io.

Installation

npm i mutator-io-plugin-in-mqtt

The configuration required is exactly the same, with the except of a new keyword called topics that will indicate which topics this instance should subscribe to.

import { IClientOptions } from 'mqtt/types'

interface Config extends IClientOptions {
  topics: string[]
}

TLS support

This kind of security is supported just like it is in MQTT.js (though there aren't many examples around)

import * as MqttInputStream from 'mutator-io-plugin-in-mqtt'

const myInputStream = new MqttInputStream({
  protocol: 'mqtts',
  host: 'my-endpoint.iot.eu-central-1.amazonaws.com',
  port: 8883,
  key: fs.readFileSync('./certs/mqtt.key'),
  cert: fs.readFileSync('./certs/mqtt.pem'),
  ca: fs.readFileSync('./certs/mqtt_ca.pem'),
  requestCert: true,
  rejectUnauthorized: true,
  topics: ['something/+/+/+/status/+/+/+']
} as MqttInputStream.Config)

Typescript documentation

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago