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

Add support for cooperative cancellation #144

Closed
wants to merge 2 commits into from
Closed

Add support for cooperative cancellation #144

wants to merge 2 commits into from

Conversation

AvenDonn
Copy link

@AvenDonn AvenDonn commented Mar 17, 2024

Hello. I've found this package in the process of replacing a different older package. The older package didn't offer any async/await anyway, so this one is already an improvement.

I've noticed that methods I would normally expect to support cancellation just don't.

I'd like to be able to pass a cancellation token of my own to Start, StartOrFail, Stop, StopOrFail.

I see you already internally manage a cancellation token and pass it on to the real underlying method calls to the websocket client. Could you provide overloads that allow me to pass my own token and link to it?

I'm not quite sure I've implemented the cancellation in the way you would have liked, so please use my PR as a suggestion. (I'm not sure how you'd like to combine with the cancellation token source you save at the class instance level)

There are considerations. Should then token passed into Start be able to also cancel the whole Listen process after Start has finished? Arguably not. Feel free to modify my code as you see fit.

@AvenDonn AvenDonn closed this Aug 3, 2024
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

Successfully merging this pull request may close these issues.

1 participant