Feature/web socket.connect returns bool instead of void (#256)
* Function Connect returns bool now * Now, function Connect throw exception when connect returns false
This commit is contained in:
Родитель
0eda04fc21
Коммит
8edacf6571
|
@ -3214,7 +3214,7 @@ namespace WebSocketSharp
|
|||
/// A series of reconnecting has failed.
|
||||
/// </para>
|
||||
/// </exception>
|
||||
public void Connect ()
|
||||
public bool Connect ()
|
||||
{
|
||||
if (!_client) {
|
||||
var msg = "This instance is not a client.";
|
||||
|
@ -3232,7 +3232,11 @@ namespace WebSocketSharp
|
|||
}
|
||||
|
||||
if (connect ())
|
||||
{
|
||||
open ();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -53,7 +53,10 @@ namespace Netcode.Transports.WebSocket
|
|||
|
||||
try
|
||||
{
|
||||
Connection.Connect();
|
||||
if(!Connection.Connect())
|
||||
{
|
||||
throw InvalidOperationException($"Cannot connect to url {Connection.Url}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче