forked from lelylan/mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (19 loc) · 659 Bytes
/
Copy pathapp.js
File metadata and controls
24 lines (19 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var server = require('./lib/server')
, debug = require('debug')('lelylan');
var ascoltatore = {
type: 'redis',
redis: require('redis'),
db: 12,
port: 6379,
host: process.env.REDIS_HOST }
, settings = {
port: process.env.NODE_PORT || 1883,
backend: ascoltatore };
var app = new server.start(settings);
app.on('published', function(packet, client) {
if (packet.topic.indexOf('$SYS') === 0) return; // doesn't print stats info
debug('ON PUBLISHED', packet.payload.toString(), 'on topic', packet.topic);
});
app.on('ready', function() {
debug('MQTT Server listening on port', process.env.NODE_PORT)
});