Registry / messaging / eflex-mqemitter-redis

eflex-mqemitter-redis

JSON →
library4.0.1jsnpmunverified

Redis-powered MQEmitter for pub/sub messaging with MQTT-like wildcards. Version 4.0.1 is the latest stable release, maintained under the mqemitter ecosystem. It uses ioredis internally, creates two Redis connections, and supports all ioredis options. Designed for Node.js with an async/emit callback pattern, it does not handle errors in the callback.

npm install eflex-mqemitter-redis
INSTALL
IMPORT
SIG · EFLEX-MQEMITTER-RE
E
eflex-mqemitter-redis
messagingjavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import mqemitterRedis from 'mqemitter-redis'
✗ const mqemitterRedis = require('mqemitter-redis')
ESM default import is standard; CommonJS require also works.
MQEmitterRedis
✓ import { MQEmitterRedis } from 'mqemitter-redis'
Named export for TypeScript type compatibility.
mqemitterRedis
✓ import mqemitterRedis from 'mqemitter-redis'
✗ import { mqemitterRedis } from 'mqemitter-redis'
Common mistake: trying to import named export instead of default.

Connects to Redis, subscribes to a topic with wildcards, emits a message, and closes the connection.

import mqemitterRedis from 'mqemitter-redis'; const mq = mqemitterRedis({ host: process.env.REDIS_HOST ?? 'localhost', port: parseInt(process.env.REDIS_PORT ?? '6379'), password: process.env.REDIS_PASSWORD ?? '' }); mq.on('hello/world', (message, cb) => { console.log('Received:', message); cb(); }); mq.emit({ topic: 'hello/world', payload: 'test' }, () => { console.log('Emitted'); mq.close(); });
Debug
Known issues
gotchaCallback in 'on' must not pass an error; emitter cannot handle it.
fix
Always call cb() with no argument; if error handling is needed, implement externally.
affects: >=0.0.0
gotchaTwo Redis connections are created; ensure Redis server allows multiple connections.
fix
Check maxclients setting on Redis server; adjust ioredis options to reuse connections if needed.
affects: >=0.0.0
deprecatedThe 'store' pattern from earlier versions might be deprecated; use plain opts.
fix
Pass Redis options directly to constructor instead of using a store object.
affects: <4.0.0
gotchaRequires ioredis, not redis (node_redis). Mixing clients causes unexpected behavior.
fix
Ensure only ioredis is installed; do not install the 'redis' package.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: mq.on is not a function
Importing the module incorrectly or not instantiating.
fix
Use import mqemitterRedis from 'mqemitter-redis' then call mqemitterRedis(opts).
Error: connect ECONNREFUSED 127.0.0.1:6379
Redis server not running or wrong host/port.
fix
Start Redis or set REDIS_HOST and REDIS_PORT environment variables.
MQEmitterRedis is not a constructor
Using named import incorrectly.
fix
Use default import: import mqemitterRedis from 'mqemitter-redis'
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
mqemitterrequiredCore MQEmitter interface; this package extends it.
ioredisrequiredRedis client library used for connectivity.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
eflex-mqemitter-redis — npm install eflex-mqemitter-redis · libregistry