-
Couldn't load subscription status.
- Fork 643
Adding Abort to C# Websocket #3352
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
base: master
Are you sure you want to change the base?
Conversation
| #else | ||
| else if (webSocket.IsConnecting || webSocket.IsNoneState) | ||
| { | ||
| webSocket.Abort(); // forceful during connecting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the contents of the if statements are the same, maybe let's just #if/#else the if statements themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g.
if (webSocket.IsConnected)
{
webSocket.Close();
}
#if UNITY_WEBGL && !UNITY_EDITOR
else if (webSocket.IsConnecting)
#else
else if (webSocket.IsConnecting || webSocket.IsNoneState)
#endif
{
webSocket.Abort(); // forceful during connecting
}
Description of Changes
The implementation of a solution to #3044 , this adds an
Abortfunction to theWebSocket, which runs ifDisconnectis called when theWebSocketis not connected.API and ABI breaking changes
Not API breaking.
Expected complexity level and risk
1
Testing
Note: Before change (either on Rust of C# server), server would see 4
Debuglog entries about connecting, but not see theInfolog about the client connection ending like would normally be seen in a disconnect. After change, server shows no log entries at all, because connection is properly aborted.