soapbox-pub / nostrify

Bring your projects to life on Nostr. 🌱 This repo is a mirror of the source on GitLab.
https://nostrify.dev/
MIT License
5 stars 2 forks source link

relay count method didn't throw error #3

Closed antonioconselheiro closed 6 days ago

antonioconselheiro commented 6 days ago

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

alexgleason commented 6 days ago

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.

antonioconselheiro commented 6 days ago

moved to an issue into strfry repo

alexgleason commented 6 days ago

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