jchristn / WatsonWebsocket

A simple C# async websocket server and client for reliable transmission and receipt of data
MIT License
277 stars 53 forks source link

Use the cancelation token #92

Closed MeTitus closed 2 years ago

MeTitus commented 2 years ago

https://github.com/jchristn/WatsonWebsocket/blob/cabf56f9914b87d4485175baaf59379a5e5576bc/src/WatsonWebsocket/WatsonWsServer.cs#L462

Just wondering why you're not using the if expression bellow in the actual while?

if (cancelToken.IsCancellationRequested) break;

jchristn commented 2 years ago

Great point, that could certainly be changed :) want to submit a PR?

MeTitus commented 2 years ago

The code needs a lot of fixing my friend, this is just one that I spotted today. Great work in getting it all together but it needs to go over a big deal of refactoring. Also, #region and all those comments are not really a thing.

jchristn commented 2 years ago

Yeah, I mainly use regions just to give myself an easy way to collapse small and large sections, primarily to allow me to focus. Happy to take a PR with your improvements!

jchristn commented 2 years ago

NuGet: https://www.nuget.org/packages/WatsonWebsocket/2.3.5 Commit: https://github.com/jchristn/WatsonWebsocket/commit/3b51689e194e6d6f835ca684a0d0a3726775b27b

Thank you!