Notorious Puppy Memes

    mutator-io-plugin-in-mqtt
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.7 • Public • Published

    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

    Install

    npm i mutator-io-plugin-in-mqtt

    DownloadsWeekly Downloads

    29

    Version

    0.1.7

    License

    MIT

    Last publish

    Collaborators

    • vshjxyz