Code Monkey home page Code Monkey logo

mqtt-reqres-broker's Introduction

mqtt-reqres-broker

mqtt request/response broker based on aedes

start mqtt reqres websocket broker

// production
$ npm start

// starts with debug 
$ npm run start:debug

make sure broker file is executable:

$ chmod u+x index.js

start options

$ npm start -- -h localhost -p 1883

// or

$ ./broker start -h 0.0.0.0 -p 1883

// or debug

$npm run start:debug

stop

press Ctrl + c

$ ./broker start
^C
$ 

test

runs mocha specs in /test

$ npm test

// or

$ npm run test:debug

see all npm tasks defined in package.json.

API

var MqttReqResBroker = require('mqtt-reqres-broker');

Methods

MqttReqResBroker()

constructor

initialize(options, callback)

send a request to an other client.

options:

  • hostname string optional default 'localhost'
  • port number optional default 1883

callback callback function called when initialization done. only arg is "err".

returns instance of MqttReqResBroker

start(options, callback)

options null required; currently takes no options

callback function required; callback

close(callback)

closes the broker websocket and http servers.

Example

var broker = new MqttReqResBroker()

broker.initialize(
  {
    hostname: '127.0.0.1',
    port: 9999
  }, function (err) {

    broker.start(null, function (err) {
      // ..  

    });
  }
);

Build docs

create annotated source documentation in doc/ folder, uses groc

$ npm run build:docs

mqtt-reqres-broker's People

Contributors

kruemelo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.