Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mchmarny/mqtt-bridge
Simple bridge to stream MQTT Broker data to dynamically defined back-ends
https://github.com/mchmarny/mqtt-bridge
Last synced: 5 days ago
JSON representation
Simple bridge to stream MQTT Broker data to dynamically defined back-ends
- Host: GitHub
- URL: https://github.com/mchmarny/mqtt-bridge
- Owner: mchmarny
- License: bsd-2-clause
- Created: 2014-01-17T21:58:23.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-06T14:58:12.000Z (over 10 years ago)
- Last Synced: 2024-11-05T17:55:18.160Z (8 days ago)
- Language: JavaScript
- Homepage:
- Size: 295 KB
- Stars: 29
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mqtt-bridge
This fully configurable MQTT bridge subscribes to MQTT broker for defined topic and streams messages published to that topic to dynamically defined backends. The configured backends subscribe to simple `data` and `flush` events which give them access to the message `topic` and `content` whenever new messages for the defined topic arrive.
Supported backends:
* Console (default)
* Redis
* statsd
* RethinkDB
* TempoDB (alpha)
* Graphite
* AWS Kinesis
* Graphite
* Xively> New backends will be added, if you don't see what you need, contribute.
## Configuration
The app includes a sample configuration file: `config-sample.json`. Simply rename that file to `config.json` and edit the portent elements:
### MQTTIf your broker does not require secure client, simply switch the `secure` and remove the no longer needed elements from the `args`: `keyPath`, `certPath`. If no authentication is required you can further remove the `username` and `password` arguments. For each one of these use-cases, the MQTT broker will also need require a different port.
"mqtt": {
"secure": true,
"topic": "#",
"host": "mqtt.mydomain.com",
"port": 8884,
"args": {
"clientId": "mqtt-bridge",
"keyPath": "./certs/client.key",
"certPath": "./certs/client.crt",
"username": "sampleuser",
"password": "samplepassword",
"keepalive": 59000
}
}> The small `keepalive` is to workaround for AWS ELB timeouts. Feel free to increase that number if you are not load-balancing the MQTT broker.
### Backends
For each backend, you must define two arguments: `handler` with the implementation file (probably located in the backends directory) and the `config` arguments for that backend. These will be anything the backend requires.
"backends": [
{
"handler": "./backends/some-backend.js",
"config": {
"arg": "val"
}
}
]
> Remember, some backends require additional installation before the initial run.### Logging
To change the verbosity of console logging, you can alter the `level` argument. See `winston` documentation for `mqtt-bridge` supported levels (debug, info, warn, error).
"log": {
"level": "debug",
"timestamp": true
}## Installation
$ npm install mqtt-bridge
## Standalone UsageTo run the `mqtt-bridge` as a standalone app, simply use the provided `start-bridge.sh` scripts which will provision `forever` to assure continuous uptime.
$ ./start-bridge.sh
To stop the service either the `stop` command in `forever` or simply execute the provided script$ ./stop-bridge.sh
## Contribute
Contributions, new/improved backbends or otherwise, are welcomed:
* Fork the project
* Improve (comments would be nice)
* Commit to your repo
* Issue a pull request in github's web interface