/// <summary> /// Sends a Ping with the specified <see cref="string"/> to the client of the <see cref="WebSocketService"/> /// instance with the specified ID. /// </summary> /// <returns> /// <c>true</c> if the <see cref="WebSocketService"/> instance receives a Pong in a time; /// otherwise, <c>false</c>. /// </returns> /// <param name="id"> /// A <see cref="string"/> that contains an ID that represents the destination for the Ping. /// </param> /// <param name="message"> /// A <see cref="string"/> that contains a message to send. /// </param> public virtual bool PingTo(string id, string message) { if (!IsBound) { return(false); } if (message == null) { message = String.Empty; } var msg = id.IsNullOrEmpty() ? "'id' must not be null or empty." : Encoding.UTF8.GetBytes(message).Length > 125 ? "The payload length of a Ping frame must be 125 bytes or less." : String.Empty; if (msg.Length > 0) { Log.Error(msg); Error(msg); return(false); } return(_sessions.PingTo(id, message)); }