Npm package to configure mqtt in easy way without need for duplicated code
Last updated a year ago by arn-the-long-beard .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @createview/mqtt-manager 
SYNC missed versions from official npm registry.


Npm package to configure mqtt in easy way without need for duplication code

JavaScript Style Guide License: MIT Build Status stability-experimental NSP Status


Expect the unexpected. Please provide feedback on api and your use-case


`npm install @createview/mqtt-manager


// lets make a json config file like this :

  "connection": "mqtt://'",
  "publication": {
    "Greeting B" :  "Greeting B",
    "Bye B" :  "Bye B"
    "Greeting A" : "Greeting A",
    "Bye A" :   "Bye A"

Here is a way of using it. You can also try npm run testA and npm run testB is this order

'use strict'
const MqttManager = require('./index.js')
const mqttconfig = require('./configA')
// define the functions to trig on messages
function displayGreeting (msg, data, mqttService) {
  // can send other message
  mqttService.publish(mqttconfig.publication['Greeting B'], 'Hello B')

function displayBye (msg, data, mqttService) {
  // can send other message
  mqttService.publish(mqttconfig.publication['Bye B'], 'bye byeB ')

let actions = [

// add actions on subscriptions
actions.push({topic: mqttconfig.subscription['Bye A'], func: displayBye})
actions.push({topic: mqttconfig.subscription['Greeting A'], func: displayGreeting})

// create a new Mqttmanager
let mqttService = new MqttManager()

// Sett he config
mqttService.setup(mqttconfig, actions)


npm test


PS : the packages was previously named @createview/mqtt-service I am very sorry for the desagrement caused by the remove of this package from Npm. I prefered to delete it after 24 h to put a good name on it :)

The package needs improvement



Current Tags

  • 1.1.0                                ...           latest (a year ago)

4 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.1.1                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 4
Last Month 6
Dependencies (5)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |