Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I maintain a long link when using pool.subscribeMany? Currently, it will automatically disconnect after 2 minutes #396

Open
jimtracy1007 opened this issue Apr 10, 2024 · 2 comments

Comments

@jimtracy1007
Copy link

jimtracy1007 commented Apr 10, 2024

`const relayConnect = async () => {
    pool.subscribeMany([...relays], [{
      kinds: [4],
      since: dayjs().unix(),
      authors: [subFrom],
      '#p': [p]
    }], {
      onevent: async (event) => {
        parseEvent(event)
      },
      onerror: async (err) => {
        console.log(err.message)
      },
      onclose: (reason) => {
        console.log(`relay connection closed at ${dayjs().format('YYYY-MM-DD HH:mm:ss')}:${reason}`);
        clearTimeout(timer);
        timer = setTimeout(async () => {
          relayConnect()
        }, 50);
      },
    })
  }

`relay connection closed at 2024-04-10 09:47:01:relay connection closed
relay connection closed at 2024-04-10 09:49:00:relay connection closed
relay connection closed at 2024-04-10 09:50:37:relay connection closed
relay connection closed at 2024-04-10 09:51:38:relay connection closed
relay connection closed at 2024-04-10 09:53:01:relay connection closed
relay connection closed at 2024-04-10 09:55:01:relay connection closed
relay connection closed at 2024-04-10 09:57:01:relay connection closed
relay connection closed at 2024-04-10 09:59:00:relay connection closed
relay connection closed at 2024-04-10 10:00:00:relay connection closed
relay connection closed at 2024-04-10 10:01:01:relay connection closed
relay connection closed at 2024-04-10 10:03:01:relay connection closed``
@fiatjaf
Copy link
Collaborator

fiatjaf commented Apr 10, 2024

Looks like the relay is closing the connection on you for some reason. What relay is it?

@jimtracy1007
Copy link
Author

wss://dev-relay.nostrassets.com,
Do we need to pay attention to the configuration of the relay we built ourselves with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants