Skip to content

Multi-relay support #5

Description

@kwsantiago

Problem

Currently whisper connects to a single relay. If that relay is down or slow, the operation fails.

Solution

Accept multiple relay URLs and publish/subscribe to all of them.

Send behavior

  • Publish to all relays in parallel
  • Success if any relay accepts
  • Report which relays succeeded/failed in verbose mode

Recv behavior

  • Subscribe to all relays
  • Deduplicate incoming messages by event ID
  • Graceful handling when relays disconnect

Interface

# Multiple --relay flags
whisper send --relay wss://relay1.example --relay wss://relay2.example ...

# Or comma-separated
whisper send --relays wss://relay1.example,wss://relay2.example ...

# Environment variable
export NOSTR_RELAYS="wss://relay1.example,wss://relay2.example"

Implementation Notes

  • Use libwebsockets multi-connection support
  • Track event IDs in a small hash set for dedup (recv)
  • First-success-wins for send, all-parallel for recv

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmediumModerate effortp1High priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions