Created
December 31, 2015 10:33
-
-
Save mcollina/a37f135136192d9c58a4 to your computer and use it in GitHub Desktop.
aedes redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var aedes = require('aedes')({ | |
mq: require('mqemitter-redis')(), | |
persistence: require('aedes-persistence-redis')() | |
}) | |
var server = require('net').createServer(aedes.handle) | |
var port = 1883 | |
server.listen(port, function () { | |
console.log('server listening on port', port) | |
}) | |
aedes.on('clientError', function (client, err) { | |
console.log('client error', client.id, err.message) | |
}) | |
aedes.on('publish', function (packet, client) { | |
if (client) { | |
console.log('message from client', client.id) | |
} | |
}) | |
aedes.on('client', function (client) { | |
console.log('new client', client.id) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "aedes-redis", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"aedes": "^0.12.0", | |
"aedes-persistence-redis": "^1.0.2", | |
"mqemitter-redis": "^1.0.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment