Implement Redis pub/sub fanout to broadcast messages to multiple subscribers

domain: redis.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Open a subscriber connection and subscribe to a channel: `SUBSCRIBE notifications` — the connection enters subscribe mode and blocks waiting for messages.
  2. From a separate publisher connection, broadcast a message: `PUBLISH notifications '{"event":"order_created","id":42}'` — all current subscribers on that channel receive the message.
  3. Use pattern subscriptions for dynamic channel names: `PSUBSCRIBE notifications.*` matches `notifications.orders`, `notifications.users`, etc.
  4. In application code (e.g., Node.js with `ioredis`), create a dedicated subscriber client (separate from the command client) and attach a `message` event handler to process incoming publishes.
  5. Monitor active channels and subscriber counts: `PUBSUB CHANNELS *` and `PUBSUB NUMSUB notifications`.

Known gotchas

Related routes

Fan out SNS messages to multiple SQS queues with subscription filter policies
aws-sns · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans