24 lines
497 B
C#
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);
|
|
}
|
|
}
|