{"id":45584,"library":"node-redis-eventbus","title":"node-redis-eventbus","description":"A simple event bus powered by node-redis for inter-process communication between multiple Node.js instances using Redis pub/sub. Current stable version is 1.2.1. It provides a lightweight API with async/await and promise patterns, TypeScript definitions included. Differentiators include a static registry for named event bus instances, a ping method to check listener availability, and automatic cleanup. Low release cadence; last update was 2018.","status":"maintenance","version":"1.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/yss14/node-redis-eventbus","tags":["javascript","typescript"],"install":[{"cmd":"npm install node-redis-eventbus","lang":"bash","label":"npm"},{"cmd":"yarn add node-redis-eventbus","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-redis-eventbus","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Redis client connectivity and pub/sub functionality","package":"redis","optional":false}],"imports":[{"note":"Named export; do not use default import. CommonJS requires destructuring.","wrong":"const EventBus = require('node-redis-eventbus').EventBus;","symbol":"EventBus","correct":"import { EventBus } from 'node-redis-eventbus'"},{"note":"Package does not have a default export; use named import.","wrong":"import EventBus from 'node-redis-eventbus'","symbol":"default","correct":"import { EventBus } from 'node-redis-eventbus'"},{"note":"If only using types, use `import type` to avoid side effects.","wrong":"import { EventBus } from 'node-redis-eventbus' (if only type needed)","symbol":"EventBus type","correct":"import type { EventBus } from 'node-redis-eventbus'"},{"note":"EventBus.create is a static factory method that returns a Promise<EventBus>. Do not use constructor.","wrong":"new EventBus(name, opts)","symbol":"create","correct":"EventBus.create(name, opts)"}],"quickstart":{"code":"import { EventBus } from 'node-redis-eventbus';\n\n(async () => {\n  const eventBus = await EventBus.create('myBus', { host: process.env.REDIS_HOST ?? 'localhost' });\n\n  await eventBus.on<string>('message', (payload) => {\n    console.log('Received:', payload);\n  });\n\n  console.log('Listening...');\n  eventBus.emit('message', 'Hello World');\n\n  setTimeout(async () => {\n    const alive = await eventBus.ping(1000, 1);\n    console.log('Alive:', alive);\n    eventBus.destory();\n  }, 100);\n})();","lang":"typescript","description":"Creates an event bus, listens for 'message' events, emits a message, pings listeners, and destroys the bus."},"warnings":[{"fix":"Use EventBus.create only once per name; retrieve later with EventBus.getByName.","message":"EventBus.create expects a unique name; using duplicate name will not create a new bus but return existing one.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Call `eventBus.destory()` (note the typo).","message":"The method `destroy` is misspelled as `destory` in the API.","severity":"gotcha","affected_versions":"<=1.2.1"},{"fix":"Consider migrating to a maintained alternative like ioredis-based event bus.","message":"Package has not been updated since 2018 and may rely on old node-redis versions.","severity":"deprecated","affected_versions":"1.2.1"},{"fix":"Ensure proper cleanup by calling destory() to avoid resource leaks.","message":"EventBus is not a singleton; many instances with different names can exist and they share the same Redis connection?","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Do not await emit(); it returns void.","message":"The `emit` method does not return a Promise; it is fire-and-forget.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.1':30 '2018':70 'api':35 'async/await':37 'automat':62 'avail':60 'bus':8,52 'cadenc':66 'check':58 'cleanup':63 'communic':18 'current':26 'definit':42 'differenti':44 'event':7,51 'eventbus':4 'includ':43,45 'instanc':22,53 'inter':16 'inter-process':15 'javascript':71 'last':67 'lightweight':34 'listen':59 'low':64 'method':56 'multipl':20 'name':50 'node':2,12 'node-redi':11 'node-redis-eventbus':1 'node.js':21 'pattern':40 'ping':55 'power':9 'process':17 'promis':39 'provid':32 'pub/sub':25 'redi':3,13,24 'registri':48 'releas':65 'simpl':6 'stabl':27 'static':47 'typescript':41,72 'updat':68 'use':23 'version':28","created_at":"2026-06-07T12:55:43.969760+00:00","updated_at":"2026-06-07T12:55:43.969760+00:00","problems":[{"fix":"Use `await EventBus.create('name')` instead.","cause":"Trying to use `new EventBus()` instead of static factory method.","error":"TypeError: EventBus is not a constructor"},{"fix":"Import using `import { EventBus } from 'node-redis-eventbus'`","cause":"Forgetting to import or using default import incorrectly.","error":"Cannot find name 'EventBus'"},{"fix":"Set environment variable REDIS_HOST or pass host in clientOpts.","cause":"Redis host not configured or unreachable.","error":"Error: getaddrinfo ENOTFOUND redis"},{"fix":"Ensure at least one listener is active or increase timeout / minResponseCount.","cause":"No listeners responded within the timeout.","error":"TimeoutError: ping timed out"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/yss14/node-redis-eventbus#readme","github":"https://github.com/yss14/node-redis-eventbus","docs":null,"changelog":null,"pypi":null,"npm":"node-redis-eventbus","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}