Too many pipes 🥁 tss

Reply to this note

Please Login to reply.

Discussion

rx-nostr?

No really, I actually hacking around observable way before rx-nostr, I am not familiar with their implementation but I don't think they put the outbox model in mind like I did, one of the differences is that I treat relays as observables instead of arrays, therefor I can "start" a subscriptions without even know which relays is going to, this makes a lot of sense for the outbox model as I start the subscription with the relays "I know" and slowly push new relays to the stream based on author filters on the fly. So no need to know the relays before hand or wrap things in promises (I barely have any promises on my codebase)

I can kinda do all of that without a single if statement or imperative code, and also very easy to write unit tests

Also, not sure if they support batching and split of filters, by treating relays as observables, this make relatively easy, my implementation of everything is somewhat 200 lines of code (ignoring types), it doesn't try to do everything tho, just a simple observables opening and completing, I am thinking about releasing a library with some useful pipelines for feeds that makes super easy to compose related subscriptions into the same stream (something like withEventAuthor(), withMentionedAuthors(), withQuotes(), withThreads()), everything connected, making it easier to teardown everything

Sounds awesome! Is there a repo to take a look?

Yes, on the core folder https://github.com/cesardeazevedo/nosotros/tree/dev2/src/core, everything is built on top of a webSocketSubject multiplex (subscribe.ts), which makes everything ridiculously easy (calling .unsubscribe() from a rxjs stream automatically sends a close message without a thought), everything chained together