Rxjs: Handling Backpressure with Special Subjects

Created on 16 Dec 2018  路  4Comments  路  Source: ReactiveX/rxjs

Feature Request

Special Subject used for controlled lossless backpressure in RxJS.

Is your feature request related to a problem? Please describe.
Currently, there's no official solution in RxJS to deal with Generators, Iterators, Node.js streams, and other pull-based systems in a controlled way.
https://github.com/ReactiveX/RxJS/issues/71

Describe the solution you'd like
I'd like a native solution to deal with pull-based systems instead of relying on IxJS.

  • IxJS isn't 1:1 compatible with RxJS operators.
  • IxJS is another library which has to be learned, maintained, and bundled.
  • RxJS already has similar specialized subject classes like WebSocketSubject.

Describe alternatives you've considered
I wrote an article about my solutions here:
https://itnext.io/lossless-backpressure-in-rxjs-b6de30a1b6d4

I created functional wrappers around a Node.js transform stream and a Generator to allow a 2-push system to simulate a pull system.

Example implementations:
Iterator - https://gist.github.com/Sawtaytoes/7b6bf968510fe88df3ec98846a641779
Node.js Stream - https://gist.github.com/Sawtaytoes/4896e9ae6091392bebfc6ba027e27bd0

These examples aren't in TypeScript and don't follow the class extension pattern in RxJS's codebase, but they reveal the same API that's used by WebSocketSubject. From a practical standpoint, they could be used as temporary measures until official implementations are written.

(If this is new operator request) describe reason it should be core operator
There's absolutely no reason another library needs to be used to handle what RxJS should be able to do with its existing tooling.

discussion feature

Most helpful comment

Good to have some "official statement" on Backpressure in RxJS to understand the direction.

All 4 comments

Wow, just read your article. Looks really tiny and promising, I gonna try it soon

As this issue was not touched until several months now I suggest to close it.
@benlesh please give feedback on how we should proceed

Good to have some "official statement" on Backpressure in RxJS to understand the direction.

There are many upvotes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shenlin192 picture shenlin192  路  3Comments

peterbakonyi05 picture peterbakonyi05  路  4Comments

chalin picture chalin  路  4Comments

Zzzen picture Zzzen  路  3Comments

jakovljevic-mladen picture jakovljevic-mladen  路  3Comments