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