nostr:npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft

Since the connect() method is async, you don't need to await the Promise.all() at the end. Instead, just return Promise.all(promises). The caller is getting a Promise either way.

https://github.com/nostr-dev-kit/ndk/blob/master/src/relay/pool/index.ts#L60

Reply to this note

Please Login to reply.

Discussion

ah yes! ofc!

thank you! 👏

keep these coming! 🙌

NP 😉 Just getting started with NDK.

I’ve noticed that the more explicit relays I add to the constructor, the longer it takes to finish connecting.

Not sure if I should have one NDK instance with 200 relays, or 200 NDK instances with one relay each.

a single instance it's better; it will try to be smart about what to connect to

right now the gossip-style behavior is not quite ready, but soon it will start connecting to other relays based on the observed behavior (largely depending on the type of app you're building)

what's your github handle?