-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add "cancellation" support - AbortSignal #449
Comments
Thanks for the note. We've been discussing cancellation earlier, also with AbortSignal/AbortController, as it's usable both in the browser and Node.js. Cancellation is a difficult topic because all the differences in the network protocols underneath makes it difficult to map and guarantee cancellation. It's not just HTTP fetch under, but could be MQTT, OCF, HTTP. Of course we could go with the client side cancellation, i.e. abort the request, reject the promises and the implementation should ignore any further protocol specifics on the client side. We can discuss this in the next calls. |
Yes exactly. To handle this case I noted two scenario:
|
I think it will cause some implementation effort for sure. In my understanding, we were settling for a consolidation phase without adding new features. For future updates, I would definitely support the exploration of this feature. Mainly for two reasons:
|
p.s. thank you @lifaon74 for reaching out and using your time to write a concrete proposal! |
Almost all the methods are async. However, there is no way to cancel these async tasks.
What if we extend
InteractionOptions
with an AbortSignal ?For example, we could imagine:
Minimal scenario: the ConsumedThing aborts any async tasks related to this
readProperty
call (ex: aborts afetch
) and returns arejected
Promise (with an AbortError if we accept DOMErrors).Extended scenario (optional): same as minimal scenario, but we may send an "abort" request too. In this case we may think about:
The client send an "abort" request for a specific property (ex:
/property-name/abort/
), or maybe if the server detects that the connection was terminated before he was able to send the property's value. In this case, thereceived
signal in setPropertyReadHandler is aborted.The text was updated successfully, but these errors were encountered: