Got at least one data fetching method working; turns out, we can't use a patched LogicStack to get the data
This commit is contained in:
29
Vendor/EmbedIO-3.5.2/WebSockets/Internal/FragmentBuffer.cs
vendored
Normal file
29
Vendor/EmbedIO-3.5.2/WebSockets/Internal/FragmentBuffer.cs
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EmbedIO.WebSockets.Internal
|
||||
{
|
||||
internal class FragmentBuffer : MemoryStream
|
||||
{
|
||||
private readonly bool _fragmentsCompressed;
|
||||
private readonly Opcode _fragmentsOpcode;
|
||||
|
||||
public FragmentBuffer(Opcode frameOpcode, bool frameIsCompressed)
|
||||
{
|
||||
_fragmentsOpcode = frameOpcode;
|
||||
_fragmentsCompressed = frameIsCompressed;
|
||||
}
|
||||
|
||||
public void AddPayload(MemoryStream data) => data.CopyTo(this, 1024);
|
||||
|
||||
public async Task<MessageEventArgs> GetMessage(CompressionMethod compression)
|
||||
{
|
||||
var data = _fragmentsCompressed
|
||||
? await this.CompressAsync(compression, false, CancellationToken.None).ConfigureAwait(false)
|
||||
: this;
|
||||
|
||||
return new MessageEventArgs(_fragmentsOpcode, data.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user