Why Nostr? What is Njump?
2025-03-26 18:28:21
in reply to

cesardias on Nostr: Highly recommend rxjs, it's been an incredible journey for me and I had to learn some ...

Highly recommend rxjs, it's been an incredible journey for me and I had to learn some things the hard way.

After a heavy year on rxjs, I manage to build very complex pipelines with have very little state (variables) and close to no imperative code, I kinda got to a point of no way back.

Your approach of takeUntil is totally correct, which is the rxjs way of doing things, a powerful advice to rxjs is to avoid Subjects at all costs, they deviate the concepts of reactive programming and forces you in the imperative approach, people using rxjs with only Subjects aren't really using rxjs at all, just a fancy event emitter (the meme), there's a reason why xstream (a alternative library to rxjs) called their `next` function `shamefullySendNext` (yes, there's use cases for Subjects)

I have no issues with typescript in rxjs, it works pretty well and point-free operators would work just fine, I have issues naming things properly.

You have to be careful as well where you subscribe to the observables, it should be the final stage and usually close to the UI, and unsubscribe when the ui is "unmounted".

I was writing this document for the other day but never had a change to finish, which is my client approach for nostr subscription in rxjs https://github.com/cesardeazevedo/nostr-observable, the idea was to have a 100% stateless library for nostr.

This file is how I handle subscription and everything else is built on top of it https://github.com/cesardeazevedo/nosotros/blob/main/src/core/operators/subscribe.ts

If you have any questions don't hesitate to ask, I would love to help anything rxjs related.
Author Public Key
npub1cesrkrcuelkxyhvupzm48e8hwn4005w0ya5jyvf9kh75mfegqx0q4kt37c