Unity-Technologies / multiplayer-community-contributions

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

Websocket : Function StartClient ALWAYS returns true. #255

Open hyryel opened 2 weeks ago

hyryel commented 2 weeks 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 2 weeks ago

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