0.0.8 • Published 5 years ago

exec-mqtt v0.0.8

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

This is a simple mqtt publish / subscribe request / replay pattern

BUILD IN PROGRESS, WILL UPDATE SOON

About

Mqtt-exec allows to execute commands on local/remote servers.

How to use

mqttClient.exec(tipic,params,meta)

  • topic: /client/name/.... method.method....*
  • params: params
  • meta (optional) : timeout - to set custom request timeout

Installation

npm install exec-mqtt --save

Example

In example below we require an "request-promise" library just for example you can set it to any objects.

Simple Example:

const mqtt = require("exec-mqtt");

const clientConnectionParams = {
  services: {rp: require('request-promise')},
  name: 'Client1',
  mqttSetting: { 
    url: "mqtt://localhost",
    port: 1883
  }
};


const mqttClient = new mqtt(clientConnectionParams);

mqttClient.init().then(client => {
    mqttClient
    .exec("Client1/rp.get", {uri: "https://restcountries.eu/rest/v2/all"} , {timeout:  5555})
    .then(res => {
      console.log(res)
    });
  });
0.0.8

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago