rsocket / rsocket-js

JavaScript implementation of RSocket

Home Page:https://github.com/rsocket/rsocket-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for global interceptors

LifeIsStrange opened this issue · comments

Axios has a standard feature called interceptors. It allow to run custom functions before onSuccess and onError, which is very expressive and allow to make along other things, normalization, validation, retries and reuse of code.

Hi @LifeIsStrange, thanks for providing the proposal for interceptor support. While our current focus in the 1.0/dev branch remains on meeting spec compliance and core features, our goal is certainly to allow for features such as interceptors to be easier to achieve. Additionally, we likely see features such as the proposed being provided externally via extension packages, rather than as a core feature of rsocket-js. With the existing API implemented to satisfy #158, I believe achieving the proposed interceptors would be achievable using such an extension package.

For an example of such an "extension", we briefly experimented with an rxjs extension to wrap the core API: https://github.com/rsocket/rsocket-js/blob/feature/dev-rxjs-extension/packages/rsocket-examples/src/rxjs-extension/extension.ts.

With that being said, we can certainly keep this in mind as development on #158 continues, however, we may not be able to commit to the request at this time.