Database Tutorial #15: Redis Pub/Sub and Streams

Redis has two messaging systems: Pub/Sub for fire-and-forget real-time events, and Streams for persistent, replayable event logs with consumer groups. Pub/Sub Pub/Sub is simple: publishers send messages to channels, subscribers receive them. Messages are not stored — if no subscriber is listening, the message is lost. # Terminal 1: Subscribe to a channel SUBSCRIBE notifications:user:1 # Terminal 2: Publish PUBLISH notifications:user:1 '{"type":"message","text":"Hello!"}' # Terminal 1 receives: "Hello!" Node.js Pub/Sub ioredis requires separate client connections for publishing and subscribing: ...

August 7, 2026 · 4 min