-
Notifications
You must be signed in to change notification settings - Fork 1
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
Is OnClose
always triggered?
#1
Comments
Hello there, this is strange. Perhaps the token is already cancelled (or the internal websocket disconnected) beforehand? Could you try checking the Websocket's I have never seen this happen before, but my guess is a premature internal websocket client disconnection (causing the token to be cancelled before). Cheers |
Hi thanks for getting back. My app is targetted at 4.6.2, so I had to make syntax changes to It is probably easiest to compile from my repo and see if it behaves according to design
My assess is some logic issue in the original |
Hello. I'm not very sure to understand the changes relevant to fixing the problem. If the issue roams from await WebSocket.CloseAsync((WebSocketCloseStatus)closeStatus, closeMessage, CancellationToken); I do not call OnClose?.Invoke(closeStatus, closeMessage); I will do some QA and testing soon, but feel free to test on your case with the following commit if this fixes your issue or not. Cheers |
CoolWebSocketClient/CoolWebSocketClient.cs
Line 138 in 775c62b
After the server gives me a response for logging off, I attempt to close the connection with this repo's
ws.Close(CoolWebSocketCloseStatus.NormalClosure)
, howeverOnClose
was not triggered.If I send
ws.Close(4)
(random integer), I get a unhandledOperationCanceledException
, "the operation was cancelled" instead.Any idea how and when
OnClose
was designed to trigger?The text was updated successfully, but these errors were encountered: