I have caching turned off. It’s weird because when I refresh the api page, it works on several browsers.

It’s opening the relays every 30 seconds and checking for a new note. So I can have the api up on Safari, and check the website on Chrome. If I refresh the page on Safari, then Chrome will get updated too.

Reply to this note

Please Login to reply.

Discussion

Instead of connecting to relays every 30 seconds, can you connect to them over websockets. Probably less overhead that way.

I know #[4]​ is working on NDK (Nostr Dev Kit) which might help in these situations. Don’t know many details about it yet though.

Awesome, that might make my life easier. I’ll keep an eye out for it

It’s already out, needs better docs https://ndk.fyi

Check out ndk-cli for very simple examples

Awesome, just read through the readme.md. Looks like it’s simple to use and already does a ton.

yeah, it's what I'm using for all my projects; definitely ready for use

Bookmarking.

I have a few projects in queue and I’ll be doing some reading and prototyping over the next week.

#[4]​ awesome work as always!

This looks awesome pablof7z! Thanks!

🤔 Caps you coming up with something special for NR???

Yes, and I finally got it working a few minutes ago 😂 Not ready to unveil yet ☺️

Why can’t you connect to the relay and run the request and leave it open?

If you do a request and pull the data after the “EOSE” message you’ll get new data coming in satisfying your query request.

I’m a little thick headed so just to try to visualize this. You have a nodejs “servlet” that’s doing these queries and then storing them for you to retrieve via an API call you invoke from a web browser?

I thought about leaving the relay open, but thought it might cause performance issues. I don’t know a whole lot about the nostr protocol. I’ll try that and see. I have to go to bed now though.

Goodnight and thanks for the help 🤙

Anytime.

Go read the NIPs and run a tool like Nostril (I think jb55 wrote it) to do some test events and queries.

It’s how I learned and had a lot of my aha moments.

Good night!