UNPKG

mqtt-server

Version:

Simple API to build your own MQTT server on top of it.

65 lines (45 loc) 2.17 kB
# mqtt-server&nbsp;&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mqttjs/mqtt-server.png)](https://travis-ci.org/mqttjs/mqtt-server) [![npm version](https://badge.fury.io/js/mqtt-server.svg)](http://badge.fury.io/js/mqtt-server) Simple API to build your own MQTT server on top of it. ## Install ```bash npm install mqtt-server --save ``` ## Examples Launch a bunch of mqtt servers (uses `create-stream-server` under the hood): ```js var fs = require('fs'); var mqttServer = require('mqtt-server'); mqttServer({ mqtt: 'tcp://localhost:1883', mqtts: 'ssl://localhost:8883', mqttws: 'ws://localhost:1884', mqtwss: 'wss://localhost:8884' }, { ssl: { key: fs.readFileSync('./server.key'), cert: fs.readFileSync('./server.crt') }, emitEvents: true // default }, function(client){ client.connack({ returnCode: 0 }); }); servers.listen(function(){ console.log('listening!'); }); ``` For more detailed information about the server configuration check out [create-stream-server](https://github.com/mqttjs/create-stream-server). ## Contributing mqtt-server is an **OPEN Open Source Project**. This means that: > Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. See the [CONTRIBUTING.md](https://github.com/mqttjs/mqtt-server/blob/master/CONTRIBUTING.md) file for more details. ### Contributors mqtt-server is only possible due to the excellent work of the following contributors: <table><tbody> <tr><th align="left">Joël Gähwiler</th><td><a href="https://github.com/256dpi">GitHub/256dpi</a></td><td><a href="http://twitter.com/256dpi">Twitter/@256dpi</a></td></tr> <tr><th align="left">Matteo Collina</th><td><a href="https://github.com/mcollina">GitHub/mcollina</a></td><td><a href="http://twitter.com/matteocollina">Twitter/@matteocollina</a></td></tr> <tr><th align="left">Adam Rudd</th><td><a href="https://github.com/adamvr">GitHub/adamvr</a></td><td><a href="http://twitter.com/adam_vr">Twitter/@adam_vr</a></td></tr> </tbody></table> ### License MIT