Pub/Sub is needed for the messenger project — message delivery between service instances via Redis.
Commands
- `SUBSCRIBE [channel ...]` — subscribe to channels
- `PUBLISH ` — publish message, returns subscriber count
- `UNSUBSCRIBE [channel ...]` — unsubscribe from channels
- `PSUBSCRIBE ` — pattern-based subscription
Implementation
- Connection enters "subscriber mode" after SUBSCRIBE — can only receive messages and run (P)SUBSCRIBE/(P)UNSUBSCRIBE
- Hub pattern: central registry of channels → subscriber connections
- Pattern matching for PSUBSCRIBE (glob-style)
- Requires changes to server connection loop to support push messages
Pub/Sub is needed for the messenger project — message delivery between service instances via Redis.
Commands
Implementation