Giter Club home page Giter Club logo

mqtt's Introduction

Lelylan MQTT Server/Broker

Requirements

The MQTT server/broker is tested against Node 0.10.36

Getting Started

$ git clone [email protected]:lelylan/mqtt.git && cd mqtt
$ npm install && npm install -g foreman
$ nf start

Install with docker

Badges

Docker image: lelylanlab/mqtt

Use docker hub image

$ docker run -d -it --name mqtt lelylanlab/mqtt

Generate local image

$ docker build --tag=mqtt .
$ docker run -d -it --name mqtt mqtt

When installing the service in production set lelylan environment variables.

Resources

Contributing

Fork the repo on github and send a pull requests with topic branches. Do not forget to provide specs to your contribution.

Running specs

$ npm install
$ npm test

Coding guidelines

Follow Felix guidelines.

Feedback

Use the issue tracker for bugs or stack overflow for questions. Mail or Tweet us for any idea that can improve the project.

Links

Authors

Andrea Reginato

Contributors

Special thanks to all contributors for submitting patches.

Changelog

See CHANGELOG

License

Lelylan is licensed under the Apache License, Version 2.0.

mqtt's People

Contributors

andreareginato avatar fedeg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mqtt's Issues

Create a client

Create a specific client that makes things even easier for the user when programming with Arduino. We need to make things easy for people to experiment the best way they can.

MQTT /get flow

After the Redis configuration the /get definition is not working. Most probably the /get channel with Mosca (or Ascoltatori) is defined as a Buffer(hex).

We need to understand how to fix this problem to make things correctly work as right now we "hack" this problem by defining a MQTT

// NORMAL FLOW (using Ascoltatori)
publish(req, '/get/')
var publish = function(req, mode) {
  payload = { message: req.body };
  payload.message = new Buffer(payload.message, 'hex');
  var topic = 'devices/' + req.params.id + mode;
  debug('[API REQ] Publishing topic', topic, req.body, payload.toString());

  ascoltatore.publish(topic, req.body, function() {
    console.log('[API REQ] Message published to the topic', topic, req.body);
  });
}
// HACK
var client = mqtt.createClient(port, host, { username: req.params.id, password: req.get('X-Physical-Secret') });
client.on('connect', function() {
   client.publish('devices/' + req.params.id + '/get', JSON.stringify(req.body));
   client.end();
})

One further note (obvious) is that the MQTT client (pass through Mosca) works just fine. If I pass through Ascoltatori it doesn't set properly the payload. We need to understand how Mosca uses ascoltatori to store the Redis messages.

Add Versioning

It's almost mandatory to add versioning to this part of the system as it could change quite a lot. And once the devices are out we can't change them all.

Dockerize

I'll send a PR with the Dockerfile

Create dynamic client

We need to offer to Lelylan a solution to easily simulate an MQTT device. We could offer something on Lelylan Node so that a client is open and closed after the supscribed notification is received.

URI - nodes.lelylan.com/mqtt/simulations/:id
FLOW - When a message is sent to the simulation URI, then a client is initialized. It listen for the message he subscribed for, receive it, update it and makes a PUT request to update the device properties in Lelylan.

Better Logging

Find out a way to log the published message from MQTT to the physical device. Right now we have the logs when the physical device sends data to Lelylan, but not when is Lelylan to send it. This is really important to investigate eventual problems.

Deploy as non root user

The deploy of mqtt is made as root but it should be as deploy user.
The code that should make this possible is the following one, but it does not work.

app.on('ready', function() {
  debug('MQTT Server listening on port', process.env.NODE_PORT)

  if (process.getuid() === 0)
    require('fs').stat(__filename, function(err, stats) {
      if (err) return console.log(err)
      process.setuid(stats.uid);
    });
});

Add presentation site

Add a one page presentation site where you describe what this project is, how we built it and why. Add all the info we could need before the project lunch. Before, we could write some tech articles on our blog.

Add examples

Add examples (at least) for the following languages.

  • Node.js
  • Arduino

emqtt with haproxy allow three server ?

hi all,
I'm using this link which is good but the problem is when I want to use 3 brokers in the cluster and when the 3 broker connect to proxy (even without clustering ) the brokers are kept open and shut down by there owns ( one broker at a time)
what is the problem, please help

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.