Skip to content

feat: Pub/Sub (SUBSCRIBE, PUBLISH, UNSUBSCRIBE, PSUBSCRIBE) #5

Description

@zulerne

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions