|
|
|
@ -3082,12 +3082,14 @@ namespace WebSocketSharp
|
|
|
|
/// </exception>
|
|
|
|
/// </exception>
|
|
|
|
public bool Ping (string message)
|
|
|
|
public bool Ping (string message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (message == null)
|
|
|
|
if (message.IsNullOrEmpty ())
|
|
|
|
throw new ArgumentNullException ("message");
|
|
|
|
return ping (EmptyBytes);
|
|
|
|
|
|
|
|
|
|
|
|
byte[] bytes;
|
|
|
|
byte[] bytes;
|
|
|
|
if (!message.TryGetUTF8EncodedBytes (out bytes))
|
|
|
|
if (!message.TryGetUTF8EncodedBytes (out bytes)) {
|
|
|
|
throw new ArgumentException ("It could not be UTF-8-encoded.", "message");
|
|
|
|
var msg = "It could not be UTF-8-encoded.";
|
|
|
|
|
|
|
|
throw new ArgumentException (msg, "message");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bytes.Length > 125) {
|
|
|
|
if (bytes.Length > 125) {
|
|
|
|
var msg = "Its size is greater than 125 bytes.";
|
|
|
|
var msg = "Its size is greater than 125 bytes.";
|
|
|
|
|