{"type":"rich","version":"1.0","title":"hodlbod wrote","author_name":"hodlbod (npub1jl…jynqn)","author_url":"https://nostr.now/npub1jlrs53pkdfjnts29kveljul2sm0actt6n8dxrrzqcersttvcuv3qdjynqn","provider_name":"njump","provider_url":"https://nostr.now","html":"Querying stuff from relays is not trivial. I am currently using 8 separate layers of abstraction to build feeds:\n\n1. A websocket wrapper\n2. A message buffer to avoid locking up the ui, sending too many concurrent reqs, and handle pausing messages while negotiating auth\n3. A target interface which allows for different relay implementations like multiplextr or a local relay\n4. An executor that works with a target to actually do stuff\n5. A subscription object which queries multiple relays, aggregates results, and tracks which relay an event was seen on\n6. A cursor object to perform windowing for a given relay\n7. A load function which throttles and merges concurrent filters with a timeout\n8. Feed/context loaders that take a filter, listen with a subscription, load using cursors, and fetch context with loaders\n\nIf relays always returned results in order it would simplify and optimize some of this away. But it really is irreducably complex."}
