Registry / database / redis-watch

redis-watch

JSON →
library0.1.4jsnpmunverified

This package provides a simple utility to monitor Redis connectivity and report problems. Version 0.1.4 is the latest release, with no known update cadence. It relies on the 'redis' npm package and allows callback-based monitoring of connection health. Differentiators are minimal; this is a very small, outdated package not recommended for production use.

npm install redis-watch
INSTALL
IMPORT
SIG · REDIS-WATCH
R
redis-watch
databasejavascriptv0.1.4
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.

watch
import { watch } from 'redis-watch'
const watch = require('redis-watch')
Package is ESM-only; using require() will fail.
default export
import watch from 'redis-watch'
const watch = require('redis-watch').default
The package does not export a default; use named import.
type definitions
import type { WatchOptions } from 'redis-watch'
import { WatchOptions } from 'redis-watch'
Type imports should use 'import type' if transpiling with TypeScript.

Sets up a Redis connection monitor that logs errors, disconnections, and reconnections, then stops after 30 seconds.

import { watch } from 'redis-watch'; const monitor = watch({ redis: { host: process.env.REDIS_HOST ?? 'localhost', port: Number(process.env.REDIS_PORT ?? 6379) }, interval: 5000, onError: (err) => console.error('Redis error:', err), onDisconnect: () => console.log('Redis disconnected'), onReconnect: () => console.log('Redis reconnected') }); // Stop monitoring after 30 seconds setTimeout(() => monitor.stop(), 30000);
Debug
Known issues
gotchaThe 'redis' dependency version is not specified, may install incompatible version leading to runtime errors.
fix
Pin 'redis' to a compatible version in your package.json.
affects: >=0.1.4
gotchaPackage has no callback for successful connection, only errors and disconnect/reconnect events.
fix
Use 'redis' client events directly to track initial connection success.
affects: >=0.1.4
deprecatedPackage is not actively maintained; last update in 2016.
fix
Consider alternatives like 'redis' built-in monitoring or 'ioredis' for more robust connectivity management.
affects: >=0.1.4
Errors
Common errors & fixes
Cannot find module 'redis'
The 'redis' peer dependency is not installed.
fix
npm install redis
TypeError: watch is not a function
Incorrect import: using default import instead of named import.
fix
Use import { watch } from 'redis-watch'
Error: getaddrinfo ENOTFOUND localhost
Redis host not reachable; default host is localhost.
fix
Set environment variable REDIS_HOST to your Redis server address.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
redisrequiredrequired to connect to Redis and monitor connection status
Agent activity
7 hits · last 30 days
node
6
Meta
1
Resources
redis-watch — npm install redis-watch · libregistry