this is the bit where nostr-tools crashes because if it receives an event from an unknown subscription ID, it then tries to access the subId key on that object and since it doesn't exist, there's an exception.
yeah, i think there's a connection issue with a lot of the relays where they seem to send rogue events for things the client didn't subscribe to yet and it causes nostr-tools to crash because it tries to insert those events into a subscription key that doesn't exist.
if you look carefully through all the new stuff that's been introduced in JavaScript after ES5, in many respects, it's an entirely new language.
remember that book that was called JavaScript: The Good Parts?
most of the new stuff that's been introduced in the past few years is more good parts, such as a safer comparison operator.
there's this type of function that modern JavaScript supports that i don't see used very often, and it's called an async generator function.
i think you could use it to replace event listeners completely, since the function can just yield whenever there is a new event and the caller can await it, and both run in an infinite loop that ping-pongs back and forth.
semi tempted to take the Relay class i wrote for NostrCrawler and turn that into a Nostr client library. i know that already exists, but it doesn't hurt to have alternatives. and i'm thinking i could try to give mine more of an async/await type API.
need a better name for NRCheck. it's not very catchy. it also happens to begin with the same letters as the Norwegian state broadcaster NRK, so now my browser wants to complete the URL wrong all the time. π
some people are having issues with NRCheck being unable to connect to hundreds of relays. i had such a case a few days back, and it appeared to be because they were using the Brave browser. i'm not sure what could be causing it. on standard Chrome and Safari, it works fine for me, both on WiFi and 4G.