🔴 Redis Beginner

What is Redis Pub/Sub?

Answer

Redis Pub/Sub (Publish/Subscribe) is a messaging pattern where publishers send messages to channels and subscribers receive all messages published to the channels they are subscribed to. Use SUBSCRIBE channel to subscribe, PUBLISH channel message to send, and UNSUBSCRIBE to unsubscribe. Subscribers receive messages in real time. A key limitation of Redis Pub/Sub is that messages are fire-and-forget — if a subscriber is offline when a message is published, it never receives it, and messages are not persisted. For durable messaging where consumers need to process messages reliably even after reconnecting, use Redis Streams instead. Pub/Sub is suitable for real-time notifications, live chat, and live dashboards.