Uwaa/HTTP/Websockets/DataFrame.cs

25 lines
497 B
C#
Raw Normal View History

2024-11-22 07:40:43 +01:00
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);
}
}