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 call cancelling via AbortController #580

Open
trombipeti opened this issue Aug 15, 2023 · 0 comments
Open

Support call cancelling via AbortController #580

trombipeti opened this issue Aug 15, 2023 · 0 comments

Comments

@trombipeti
Copy link

trombipeti commented Aug 15, 2023

Currently, call cancelling is implemented with a simple cancel() method on the returned Promise object. This is not perfect for the following reasons:

  • The cancel() method is "lost" after calling .then() on the promise
  • when calling cancel(), it is impossible to specify the reason with which the original promise will get rejected, so one must experiment/look in the library code to see that it is always a new Error("Cancelled")

I think it would be fairly easy to implement this: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal#implementing_an_abortable_api

(I don't know if this is relevant, but @types/autobahn will need to get updated anyways, too, as it doesn't declare the cancel() method, and wouldn't have the AbortSignal parameter either)

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

No branches or pull requests

1 participant