This repository has been archived on 2023-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
hamakaze/Hamakaze/WebSocket/WsTextMessage.cs

21 lines
496 B
C#
Raw Permalink Normal View History

2022-04-09 22:34:05 +00:00
using System.Text;
namespace Hamakaze.WebSocket {
public class WsTextMessage : WsMessage {
public string Text { get; }
public WsTextMessage(byte[] data) {
if(data?.Length > 0)
Text = Encoding.UTF8.GetString(data);
else
Text = string.Empty;
}
public static implicit operator string(WsTextMessage msg) => msg.Text;
public override string ToString() {
return Text;
}
2022-04-09 22:34:05 +00:00
}
}