Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mqemitter-redis

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqemitter-redis - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

39

mqemitter-redis.js
'use strict'
var redis = require('redis')
var Redis = require('ioredis')
var MQEmitter = require('mqemitter')

@@ -8,2 +8,3 @@ var shortid = require('shortid')

var LRU = require('lru-cache')
var msgpack = require('msgpack-lite')

@@ -18,4 +19,4 @@ function MQEmitterRedis (opts) {

this.subConn = createConn(opts)
this.pubConn = createConn(opts)
this.subConn = new Redis(opts)
this.pubConn = new Redis(opts)

@@ -32,3 +33,3 @@ this._topics = {}

function handler (sub, topic, payload) {
var packet = JSON.parse(payload)
var packet = msgpack.decode(payload)
if (!that._cache.get(packet.id)) {

@@ -40,7 +41,7 @@ that._emit(packet.msg)

this.subConn.on('message', function (topic, message) {
this.subConn.on('messageBuffer', function (topic, message) {
handler(topic, topic, message)
})
this.subConn.on('pmessage', function (sub, topic, message) {
this.subConn.on('pmessageBuffer', function (sub, topic, message) {
handler(sub, topic, message)

@@ -54,18 +55,3 @@ })

function createConn (opts) {
var conn = redis.createClient(opts.port || null,
opts.host || null,
opts.redis)
if (opts.password !== undefined) {
conn.auth(opts.password)
}
conn.select(opts.db || 0)
conn.retry_backoff = 5
return conn
}
['emit', 'on', 'removeListener', 'close'].forEach(function (name) {
;['emit', 'on', 'removeListener', 'close'].forEach(function (name) {
MQEmitterRedis.prototype['_' + name] = MQEmitterRedis.prototype[name]

@@ -135,7 +121,6 @@ })

this.pubConn.publish(msg.topic, JSON.stringify(packet), function () {
if (done) {
setImmediate(done)
}
})
this.pubConn.publish(msg.topic, msgpack.encode(packet))
if (done) {
setImmediate(done)
}
}

@@ -142,0 +127,0 @@

{
"name": "mqemitter-redis",
"version": "0.3.0",
"version": "1.0.0",
"description": "Redis-based MQEmitter",

@@ -8,6 +8,7 @@ "main": "mqemitter-redis.js",

"inherits": "^2.0.1",
"mqemitter": "^0.4.0",
"redis": "^0.12.1",
"shortid": "^2.2.2",
"lru-cache": "^2.6.4"
"ioredis": "^1.13.2",
"lru-cache": "^4.0.0",
"mqemitter": "^1.0.0",
"msgpack-lite": "^0.1.14",
"shortid": "^2.2.2"
},

@@ -17,5 +18,8 @@ "devDependencies": {

"pre-commit": "^1.0.7",
"standard": "^4.0.1",
"standard": "^5.4.1",
"tape": "^4.0.0"
},
"optionalDependencies": {
"hiredis": "^0.4.1"
},
"scripts": {

@@ -25,3 +29,6 @@ "lint": "standard",

},
"pre-commit": ["lint", "test"],
"pre-commit": [
"lint",
"test"
],
"repository": {

@@ -28,0 +35,0 @@ "type": "git",

@@ -30,3 +30,3 @@ mqemitter-redis  [![Build Status](https://travis-ci.org/mcollina/mqemitter-redis.png)](https://travis-ci.org/mcollina/mqemitter-redis)

})
var msg = {
var msg = {
topic: 'hello world'

@@ -33,0 +33,0 @@ payload: 'or any other fields'

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc