
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
ioredis-eventemitter
Advanced tools
Redis pubsub using an event emitter via ioredis Redis client
Redis pubsub using an event emitter via ioredis Redis client
ioredis is a robust, performance-focused and full-featured Redis client for Node and io.js.
This work based on redis-eventemitter
##Install
npm install ioredis-eventemitter
pub/sub clients must be compatible ioredis
var redis = require('ioredis-eventemitter');
var pubsub = redis({
port: 6379,
host: '127.0.0.1',
prefix: 'production:',
password: 'mypassword'
// in case you want to control Redis clients
// creation you can specify pub/sub clients pair:
// pub: pubClient,
// sub: subClient
});
// Listen for messages on the *:newuser channel
pubsub.on('*:newuser', function(channel, user) {
console.log(channel); // prints "myservice:newuser"
console.log(user); // user is a json map as expected
});
// Publish an event "production:myservice:newuser" to the redis pubsub
pubsub.emit('myservice:newuser', { id:'a1b2c3', email:'foo@example.com' });
var redis = require('ioredis-eventemitter');
var pubsub = redis({ prefix: 'production:' });
pubsub.emit('myservice:newuser', { id:'a1b2c3' });
var redis = require('ioredis-eventemitter');
var pubsub = redis({ prefix:'production:' });
pubsub.on('*:newuser', function(channel, message) {
console.log(channel); // myservice:newuser
console.log(message); // { id:'a1b2c3' }
});
To be able to handle errors (like when the redis server is down) .on('error', ...)
should be used.
Note that this means that you can't listen for messages on the error
channel.
Removes listener.
Removes all listeners.
Port for the redis server. Defaults to 6379.
Host for the redis server. Defaults to 127.0.0.1.
Password for the redis server. Defaults to not being set.
A prefix that is added to the channel name, when publishing events to the redis pubsub. Useful for separating services or environments, e.g. production
, development
, and staging
.
It is also removed when the listeners is invoked.
ioredis compatible Redis client instance used for publish
.
ioredis compatible Redis client instance used for subscribe
.
FAQs
Redis pubsub using an event emitter via ioredis Redis client
The npm package ioredis-eventemitter receives a total of 52 weekly downloads. As such, ioredis-eventemitter popularity was classified as not popular.
We found that ioredis-eventemitter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.