Redis pub/sub using a simple event emitter. Current stable version 2.0.1. Wraps the event emitter pattern around Redis pub/sub, allowing Node.js developers to use familiar .on() and .emit() methods for pub/sub messaging. Supports pattern subscriptions with wildcards, prefixes for namespacing channels, and custom Redis clients. Differentiates by providing a high-level API that abstracts Redis pub/sub details, though it is limited in flexibility and has known gotchas with error handling and prefix behavior.
npm install redis-eventemitterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a redis pub/sub emitter, subscribes to all events under 'myapp:', emits an event, then cleans up.
Use a separate error handler; do not rely on .on('error') to receive messages.Ensure prefix ends with ':' and be aware that subscribe patterns should not include prefix.
Check that options are correctly passed; avoid positional arguments.
Migrate to a more modern Redis client if possible.
Replace 'new redis(...)' with 'const pubsub = redis(...)'.
Ensure you import the function and call it with options: 'const pubsub = require('redis-eventemitter')(options)'.Correct the host/port in options.url or host/port fields.