Satswalker / nostr_dart

A Nostr client library written in Dart
MIT License
1 stars 0 forks source link

Timeout exception when sending a subscription request after unsubscribing from a previous subscription #9

Closed Satswalker closed 1 year ago

Satswalker commented 1 year ago

Steps to reproduce:

  1. Make a first subscription request with Nostr.pool.subscribe and await for its returned Future to complete.
  2. Close the first subscription with Nostr.pool.unsubscribe.
  3. Make a second subscription request and watch things break. "No response from [relay URL]" log message is printed.

Observed in v0.6.1

Satswalker commented 1 year ago

Root cause is fairly obvious. Messages sent to relays are async operations whose Futures complete upon the relay acknowledging the message was processed. nostr_dart uses Command Results and EOSE notices as this acknowledgement however neither of these messages are returned in response to a "CLOSE" message which is sent by Nostr.pool.unsubscribe.