1.1.1 • Published 5 years ago

fpm-plugin-mqtt-client v1.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

FPM-PLUGIN-MQTT-CLIENT

用于 mqtt-client 的插件

Install

npm add fpm-plugin-mqtt-client --save

Useage

  • config

    {
      "mqttserver":{
        "host": "localhost",
        "port": 1883,
        "username": "admin",
        "password": "123123123",
        "clientId": "foo",
      }
    }

    docker enviroment

    MQTT_HOST: mqttserver
    MQTT_PORT: 1883
    MQTT_USER: 'admin'
    MQTT_PASS: '123123123'
    MQTT_CLIENTID: 'client-foo'
  • subscribe

    // subscribe a topic
    fpm.execute('mqttclient.subscribe', { topic: '$d2s/a111' });
    
    // subscribe topics
    fpm.execute('mqttclient.subscribe', { topic: '$d2s/a111,$test' });
    // or
    fpm.execute('mqttclient.subscribe', { topic: [ '$d2s/a111', '$test'] });

// handle the message. fpm.subscribe('$d2s/a111', (topic, payload) => { console.log(topic, payload); });

- other

```javascript
1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.2

6 years ago

0.0.1

6 years ago