|
|
|
@ -2699,19 +2699,19 @@ namespace WebSocketSharp
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
public bool Ping (string message)
|
|
|
|
public bool Ping (string message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (message == null || message.Length == 0)
|
|
|
|
if (message == null)
|
|
|
|
return Ping ();
|
|
|
|
throw new ArgumentNullException ("message");
|
|
|
|
|
|
|
|
|
|
|
|
byte[] data;
|
|
|
|
byte[] bytes;
|
|
|
|
var msg = CheckPingParameter (message, out data);
|
|
|
|
if (!message.TryGetUTF8EncodedBytes (out bytes))
|
|
|
|
if (msg != null) {
|
|
|
|
throw new ArgumentException ("It could not be UTF8 encoded.", "message");
|
|
|
|
_logger.Error (msg);
|
|
|
|
|
|
|
|
error ("An error has occurred in sending a ping.", null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
if (bytes.Length > 125) {
|
|
|
|
|
|
|
|
var msg = "Its size is greater than 125 bytes.";
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException ("message", msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Ping (WebSocketFrame.CreatePingFrame (data, _client).ToArray (), _waitTime);
|
|
|
|
return ping (bytes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
|