This is something I wish I knew about development with nostr ... These errors in the front end. I can only assume I'm either getting blocked from connecting from the remote servers all at once, or from my end, but don't have a clue how to resolve that

My pattern causing this is essentially ...

import {RelayPool} from 'nostr-relaypool';

const localpool = new RelayPool();

localpool.subscribe(...)

with localpool.close(); when done.

This is called periodically (currently 15 seconds). I've yet to figure out how to setup the logic to open the subscription, poll for new events, and stay open waiting for new ones and do reconnects and resubscribes if it gets disconnected.

Surely there has to be a way to talk to relays that doesn't connect/disconnect over and over.

Reply to this note

Please Login to reply.

Discussion

nostr is not meant for large volume on the frontend it seems

sad.

I'll try backing off how frequently Im checking the relays. Maybe that will mitigate.

you could try ndk.. it maintains the connection for you and emits you events when they arrive from your subs

this log just looks like a client bug tbh, cause it says interrupted while page is loading..

maybe if it has documented usage patterns. i'll look into it if i cant hack this thing together the way i want

Relays will unlikely cause connection interrupts. Either browser related or fronted bug. No idea how to fix 🙂