Skip to content

Conversation

@rekhoff
Copy link
Contributor

@rekhoff rekhoff commented Oct 3, 2025

Description of Changes

The implementation of a solution to #3044 , this adds an Abort function to the WebSocket, which runs if Disconnect is called when the WebSocket is not connected.

API and ABI breaking changes

Not API breaking.

Expected complexity level and risk

1

Testing

  • Test locally with a C# CLI test client.
    Note: Before change (either on Rust of C# server), server would see 4 Debug log entries about connecting, but not see the Info log 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.
  • Test locally with a C# WebGL test client.

@rekhoff rekhoff self-assigned this Oct 3, 2025
@rekhoff rekhoff requested a review from jdetter October 3, 2025 15:49
@rekhoff rekhoff marked this pull request as ready for review October 3, 2025 17:31
@bfops bfops added the release-any To be landed in any release window label Oct 6, 2025
#else
else if (webSocket.IsConnecting || webSocket.IsNoneState)
{
webSocket.Abort(); // forceful during connecting
Copy link
Collaborator

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?

Copy link
Collaborator

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
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants