You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That fails from time to time with NDKPublishError: Not enough relays received the event.
If I wait for 5 seconds, then it always works:
await ndk.connect(5000);
await new Promise(resolve => setTimeout(resolve, 5000));
const ndkEvent = new NDKEvent(ndk);
ndkEvent.xxx = xxx
await ndkEvent.publish()
I think that's a bug, because the timeout should wait 5 seconds before returning. I see this in ndk's code: If the timeout is reached, the connection will be continued to be established in the background.
The text was updated successfully, but these errors were encountered:
I'm trying to understand NDK and find the documentation lacking but Gemini 2.0 Pro told me that even with timeout, the connect() method probably does not block until any connection was established and guessed it would emit events when that happens.
I tried to understand Pablo's highlighter code and couldn't find any such event handling. In fact his code looks like working under the same assumptions as @ktecho's example above, unless I missed something ...
In flockstr I see ndk.pool.on("connect", () => console.log("✅ connected")); but it's only for debugging, not to signal readiness to publish.
I saw mention of some caching that allows for async handling of publishing but no example neither.
When trying to publish events, I try doing this:
That fails from time to time with
NDKPublishError: Not enough relays received the event
.If I wait for 5 seconds, then it always works:
I think that's a bug, because the timeout should wait 5 seconds before returning. I see this in ndk's code:
If the timeout is reached, the connection will be continued to be established in the background.
The text was updated successfully, but these errors were encountered: