Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for request cancellation #12

Open
slavafomin opened this issue Aug 24, 2020 · 2 comments
Open

Support for request cancellation #12

slavafomin opened this issue Aug 24, 2020 · 2 comments

Comments

@slavafomin
Copy link

slavafomin commented Aug 24, 2020

Hello!

Thank you for this great library!

One of the greatest things about RxJS observables is that they are cancellable, this is especially important when it comes to network requests. So you will definitely want to terminate the pending network request, when it's result is no longer needed by the application (see switchMap). By briefly looking at the code I can't see the logic related to request cancelling, however, axios supports this. I would suggest to implement this critical feature.


axios-observable also has this feature.

@davguij
Copy link
Owner

davguij commented Aug 31, 2020

Thanks for the suggestion @slavafomin!

There's something I'd appreciate your input on, though:

I'm thinking that unsubscribing from the observables could also trigger the request cancellation in the background, somewhat similar to what axios-observable is doing, and the actual request cancellation would then be hidden to the user.

Does this make sense, or would it be better to provide with an unsubscribe() method that only unsubscribes and a cancel() method that only cancels the request?

@slavafomin
Copy link
Author

@davguij I believe that unsubscribing from observable should automatically free all associated resources, including cancelling the HTTP request in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants