|
|
|
@ -3106,10 +3106,21 @@ namespace WebSocketSharp
|
|
|
|
/// </remarks>
|
|
|
|
/// </remarks>
|
|
|
|
public void Connect ()
|
|
|
|
public void Connect ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string msg;
|
|
|
|
if (!_client) {
|
|
|
|
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
|
|
|
|
var msg = "This instance is not a client.";
|
|
|
|
_logger.Error (msg);
|
|
|
|
throw new InvalidOperationException (msg);
|
|
|
|
error ("An error has occurred in connecting.", null);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_readyState == WebSocketState.Open) {
|
|
|
|
|
|
|
|
var msg = "The connection has already been established.";
|
|
|
|
|
|
|
|
_logger.Warn (msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_readyState == WebSocketState.Closing) {
|
|
|
|
|
|
|
|
var msg = "The close process is in progress.";
|
|
|
|
|
|
|
|
_logger.Warn (msg);
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|