soapbox-pub/nostrify

relay count method didn't throw error

antonioconselheiro opened this issue · 3 comments

Strfry doesn't support NIP-45 count, it throws NOTICE when unkown filter is given.
Relay count method from nostrify didn't listen to this NOTICE and keep the promise waiting forever.

image

You NEED to pass a signal to all methods when you use Nostrify. For example:

const { count } = await relay.count(filter, { signal: AbortSignal.timeout(1000) })

You need to pass a signal for all methods.

If you don't, Nostrify will wait forever. This is the expected and intended behavior.

There is no standardized way use a NOTICE message to cancel a COUNT automatically. For other methods, we listen for OK and CLOSED, but you should still specify an AbortSignal in case the relay doesn't return these.

moved to an issue into strfry repo

I did not see until now that NIP-45 actually supports the CLOSED verb, so I added support for it in NRelay1 here: https://gitlab.com/soapbox-pub/nostrify/-/merge_requests/105

Released in @nostrify/nostrify@0.36.1