Nonsense Placement Mandatory

    mqemitter-mqtt

    4.2.0 • Public • Published

    MQEmitter that bridges to another MQTT broker.

    Specify the topic(s) to subscribe to on the remote broker and messages received from that broker will be republished to clients on the local broker.

    Messages published by clients connected to the local broker are republished to the remote broker.

    Install (don't forget to also install MQTT.js):

    npm install mqemitter-mqtt mqtt
    

    Example:

    const aedes = require('aedes');
    const MQEmitterMQTT = require('mqemitter-mqtt');
    const fs = require('fs');
    
    const server = aedes({
      mq: new MQEmitterMQTT({
        // These options go to `mqtt.connect()`:
        url: 'mqtts://broker.example.org',
        ca: fs.readFileSync('ca.crt'),
        cert: fs.readFileSync('my.crt'),
        key: fs.readFileSync('my.key'),
        clientId: 'client1',
        username: 'alice',
        password: 'secret',
        clean: false,
    
        // These options go to 'mqtt.Client#subscribe()':
        topics: 'my/topics/#',
        qos: 1,
    
        // These options let you modify the topic and payload
        // sent to/received from upstream:
        transformToUpstream({ topic, payload }) {
          // Or return falsy to skip publishing this message.
          return { topic, payload };
        },
        transformFromUpstream({ topic, payload }) {
          return { topic, payload };
        },
      }),
    });

    Install

    npm i mqemitter-mqtt

    DownloadsWeekly Downloads

    20

    Version

    4.2.0

    License

    MIT

    Unpacked Size

    3.44 kB

    Total Files

    3

    Last publish

    Collaborators

    • jdiamond