Skip to content

Instantly share code, notes, and snippets.

@mcollina
Created December 31, 2015 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcollina/a37f135136192d9c58a4 to your computer and use it in GitHub Desktop.
Save mcollina/a37f135136192d9c58a4 to your computer and use it in GitHub Desktop.
aedes redis
'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)
})
{
"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