Registry / messaging / redis-sub

redis-sub

JSON →
library1.0.0jsnpmunverified

A small Redis subscription wrapper for Node.js that simplifies subscribing to Redis channels. Version 1.0.0 is stable but unmaintained since 2013. It wraps the `redis` npm package v0.8.2, providing an event emitter interface for channel subscriptions. Unlike more modern alternatives like ioredis or node-redis v4, this package is outdated and lacks support for newer Redis features, TLS, and clustering. It requires manual connection handling and does not include automatic reconnection logic.

npm install redis-sub
INSTALL
IMPORT
SIG · REDIS-SUB
R
redis-sub
messagingjavascriptv1.0.0
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
const redisPubSub = require('redis-sub');
import redisPubSub from 'redis-sub';
Package is CommonJS only; ES modules not supported.

Creates a Redis subscription client, listens to the 'ducks' channel, publishes a message, and removes the listener after 5 seconds.

const redisPubSub = require('redis-sub'); const pubsub = new redisPubSub({ host: '127.0.0.1', port: 6379 }); pubsub.on('ducks', (quack) => { console.log('QUACK!!?', quack); }); pubsub.pubClient.publish('ducks', 'Quack! Quack...? QUUAWWWKWKKK'); setTimeout(() => { pubsub.removeListener('ducks', duckFunc); }, 5000);
Debug
Known issues
deprecatedPackage uses redis v0.8.2 which has known security vulnerabilities (CVE-2021-27292).
fix
Upgrade to a maintained alternative like 'ioredis' or 'redis' v4.
affects: >=0.0.0
gotchaThe constructor does not return a new instance when called without 'new'.
fix
Always instantiate with 'new redisPubSub(options)' or use the factory pattern from the docs.
affects: >=1.0.0
breakingNo error handling for connection failures; subscription will silently fail if Redis is unreachable.
fix
Implement your own error handling by listening to the subClient's 'error' event.
affects: >=1.0.0
deprecatedThe package has not been updated since 2013 and is considered abandoned.
fix
Migrate to actively maintained libraries like 'ioredis' or the official 'redis' v4.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'redis-sub'
Package not installed or typo in require path.
fix
Run 'npm install redis-sub' or correct the require path to 'redis-sub'.
TypeError: redisPubSub is not a constructor
Forgot to use 'new' when instantiating.
fix
Use 'new redisPubSub({})' instead of redisPubSub({}).
Error: The 'subClient' property is null
Subscription client not initialized due to missing Redis server or incorrect host/port.
fix
Ensure Redis is running and options like host/port are correct. Listen for 'connect' event on subClient.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
redisrequiredRequired for Redis client functionality (pub/sub client)
Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
redis-sub — npm install redis-sub · libregistry