Skip to content

Conversation

@rolznz
Copy link
Contributor

@rolznz rolznz commented Oct 5, 2025

PR can be tested with Alby JS SDK: getAlby/js-sdk#486

TODOs

  • implement commented out code / FIXMEs (e.g. publishing after app deletion)
  • thorough testing
    • automatic reconnection (our reconnection code was removed) - this is handled by the pool, re-connections after 3+ seconds (there is backoff logic)
    • If the hub starts subscribing when the relay is down, will it reconnect to the relay once the relay comes back up? Yes (+ republishes info events for that relay)
    • check duplicate event handling on hub side when JS SDK publishes request to both relays - Logs "Event already processed" warning - not an issue (other reaons for this e.g. client for some reason publishes an event twice) - NOTE: this is an issue in go-nostr - Fernando to submit a PR to properly de-duplicate events
    • what happens if new app is created when one relay is down then the other relay goes down and the first relay is up again? publish retries are now on a per-relay level
    • what happens to notifications sent to one online relay, then another relay comes back online (notification was successful for first relay, nothing needed to do)
    • app is created when all relays are down and then relay is reconnected - does it publish info event? yes
    • Ensure clients that don't support multiple relays still work as before (and pick the first relay from the list)
      • Alby JS SDK (pre-multi relay support)
      • Primal iOS - zaps work
      • Damus - wallet displaying balance works
      • Amethyst - only takes first relay param when configuring URL, zaps work
      • https://supertestnet.github.io/nwc_tester/ - no - takes the last relay because of its custom NWC URL handling code rather than using standard url parsing
    • test nwc_app_updated when relays online
    • test app deleted (should remove info event from relay)
    • ensure nwc_app_updated later publishes when offline relay comes back online
  • Display relays in UI a bit better (Show online status?)
  • Add second Alby relay to default config (currently only has one relay) - moved to Add second relay to default config #1887 - will be deployed in a separate hub version
  • what happens if we fail to publish the info event to one relay? (hub would have to restart to later publish to it)
  • Test 1-click flow (HTTP version)
  • Test 1-click flow (NWA version)

Notes:

  • Spec changes

    • 1-click connection flow has relayUrl for http callback. This is wrong, probably best to call it relayUrls and keep relayUrl for backward compatibility until apps update (e.g. bitcoin connect) - added comment on existing client created secret PR.
    • clarify nip-47 spec for multiple relays (relay=firstrelay&relay=secondrelay) - should not needed - standard way to pass the same property multiple times in a URL)

    Move to new issue:

@rolznz rolznz requested a review from frnandu October 5, 2025 11:45
@rolznz rolznz added this to the v1.21.0 milestone Oct 13, 2025
- update app deleted and updated consumers to handle multiple relays
- handle multiple relays in healthcheck
- display relay online status in about page
- renaming and improved comments
@rolznz rolznz changed the title feat: support multiple relays (WIP) feat: support multiple relays Oct 28, 2025
@rolznz rolznz requested a review from im-adithya October 28, 2025 16:57
@rolznz rolznz marked this pull request as ready for review October 28, 2025 16:57
@rolznz rolznz merged commit 377a316 into master Nov 6, 2025
11 checks passed
@rolznz rolznz deleted the feat/multiple-relays branch November 6, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants