Uwaa/HTTP/Websockets/DataFrame.cs
2024-11-22 06:40:43 +00:00

24 lines
497 B
C#

using System.Text;
namespace Uwaa.HTTP.Websockets;
public readonly struct DataFrame
{
public readonly WSOpcode Opcode;
public readonly bool EndOfMessage;
public readonly ArraySegment<byte> Payload;
public DataFrame(WSOpcode opcode, bool endOfMessage, ArraySegment<byte> payload)
{
Opcode = opcode;
EndOfMessage = endOfMessage;
Payload = payload;
}
public string AsString()
{
return Encoding.UTF8.GetString(Payload);
}
}