Upon doing a bit of benchmarking I realized that using https as well for rbr.bio was is the wrong way to go, so I'll switch to using wss and nostr standard for my light client.

It also means that I'll implement NIP-45 for COUNT to get number of followers with this query:

["COUNT", "", {kinds: [3], '#p': []}]

["COUNT", "", {count: 238}]

Reply to this note

Please Login to reply.

Discussion

can you share more information about the benchmark?

It was just a very simple getting https requests from the browser vs sending ws messages, and WebSocket / Nostr won by 10x. Maybe working more on HTTP/3.0 support would speed things up and allow better caching, but it's probably just not worth it, as it's getting farther from the original Nostr protocol:

w=new WebSocket("wss://rbr.bio"); w.onopen=()=>console.log("opened"); w.onmessage=(x)=>console.log("message", x)

z=0;all=1000;time=Date.now();w.onmessage=(x)=>{if(JSON.parse(x.data)[0]=="EVENT") z++; if(z==all) console.log("time",Date.now()-time) }; for(i=0;i

// 2500ms

let u="https://rbr.bio/82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2/metadata.json"

time=Date.now(); a=[];for(i=0; i<1000; i++) a.push(fetch(u)); for(i=0; i

// 21035ms

Also tested JSON.parse:

time=Date.now();for(i=0; i<1000; i++) JSON.parse(data);Date.now()-time

// 2ms