Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
452 stars 163 forks source link

Websocket : Function StartClient ALWAYS returns true. #255

Open hyryel opened 5 months ago

hyryel commented 5 months ago

Hi, I've experienced an error where the function StartClient returns true whereas the client is not actually connected.

In the file Netcode.Transports.WebSocket.WebSocketTransport, line 122, there is a return true;

I've drilled down the misfunction, and it seems that the lib WebSocketSharp return void in it's Connect function.

As the code of WebSocketSharp is in this repo, Could you patch the file : WebSocket-Sharp.WebSocket.cs on lines 3234 to change :

if( connect())
  open()

by

if( connect())
  open()
else
  throw new InvalidOperationException("Could not connect to the server");

Or better, make a fix so that the function Connect returns bool instead of void ? Even better, I could propose a patch ?

hyryel commented 5 months ago

I've created a PR to address this issue : PR 256 - Connect returns true instead of void