rsocket-flowable provides a JavaScript implementation of the ReactiveStreams specification, forming a core component of the `rsocket-js` monorepo. It defines fundamental interfaces and types for reactive programming, such as `Flowable`, `Single`, `ISubscriber`, and `ISubscription`, crucial for building non-blocking, asynchronous data pipelines with backpressure. The package is currently in an early alpha state, with the latest version being `0.0.29-alpha.0`. The `rsocket-js` project, and consequently `rsocket-flowable`, has an active but pre-stable release cadence, with frequent alpha updates. Its primary differentiator is its role in enabling the RSocket protocol's Reactive Streams semantics over various transports, providing fine-grained control over data flow and resource management through explicit backpressure.
npm install rsocket-flowableVerified import paths — ran on the pinned version, not inferred.
This TypeScript quickstart demonstrates how to create a `Flowable` producer and subscribe to it, illustrating core ReactiveStreams concepts of `onSubscribe`, `onNext`, `onError`, `onComplete`, backpressure management via `request()`, and explicit cancellation.
Users are strongly advised to migrate away from `rsocket-flowable`. The RSocket-JS ecosystem has evolved, and direct usage of `Flowable` from this standalone package is no longer the recommended pattern for RSocket communication. Instead, utilize the reactive types integrated within `@rsocket/core` or through adapters like `rsocket-adapter-rxjs` if you require RxJS interoperability. Review the latest `rsocket-js` documentation and examples for current best practices.
Ensure that your `ISubscriber.onSubscribe` implementation calls `subscription.request(n)` to signal initial demand. Subsequently, call `subscription.request(n)` in `onNext` (or another appropriate lifecycle method) when more items are processed and truly needed, respecting your consumer's capacity.
Always use ES Module `import` syntax (e.g., `import { Flowable } from 'rsocket-flowable';`). Ensure your project's `tsconfig.json` (for TypeScript) and build tools (like Webpack or Rollup) are configured to support ES Modules. For Node.js, ensure your `package.json` specifies `"type": "module"` if you are using `.js` files or use `.mjs` extension.Verify that the variable `myFlowable` is indeed an instance of `Flowable` from `rsocket-flowable`. Check your import statement: `import { Flowable } from 'rsocket-flowable';`.In your `ISubscriber` implementation, ensure the `onSubscribe` method calls `subscription.request(n)` to initiate demand. Continue to call `subscription.request(n)` as more items are consumed to maintain appropriate backpressure.
Add the correct ES Module import at the top of your file: `import { Flowable, ISubscriber, ISubscription } from 'rsocket-flowable';`.No dependency data recorded yet.