t4t5 / nostr-react

React Hooks for Nostr 🦤
MIT License
86 stars 14 forks source link

websocket reconnection #3

Open wds4 opened 1 year ago

wds4 commented 1 year ago

Using nostr-react, I have managed to put a lot of basic functionality in place, including the main feed which loads very quickly, both in "following" mode and in "firehose" mode (completely unfiltered). One issue I have is that relay connections tend to get dropped after a short while, so I'm wondering: what would be the best method to reopen them? Should there be a module to check status periodically? Would it make more sense for this be part of nostr-react or something I'd build separately in my client?

wds4 commented 1 year ago

Seems like sometimes this is a problem, sometimes it's not. Every now and then I need to quit my desktop client and restart it to get a dropped nostr feed working again, but sometimes it seems to maintain for quite a while.

wds4 commented 1 year ago

I created a release (v0.1.0-alpha) for macOS, pulled up the app, left it on all night, and the next morning the connections remain intact. Main feed as well as individual profile data. And loading is very fast! 😃

But for the app running in dev mode, the console reports all of my nostr connections are closed, and the only way I can reconnect them is to restart the app. So I still haven't figured this problem out or whether it's something I need to worry about.