chunk websocket frame when buff > 15M (#981)

* ws is now chunked

* remove chunk in example

* fix build
This commit is contained in:
Boshi Lian
2022-08-21 13:29:36 -07:00
committed by GitHub
parent ca4e350924
commit fd6f920e40
5 changed files with 209 additions and 20 deletions

View File

@@ -73,17 +73,7 @@ namespace cp
memoryStream.Position = 0;
const int bufferSize = 31 * 1024 * 1024; // must be lower than 32 * 1024 * 1024
byte[] localBuffer = new byte[bufferSize];
while (true)
{
int numRead = await memoryStream.ReadAsync(localBuffer, 0, localBuffer.Length);
if (numRead <= 0)
{
break;
}
await stdIn.WriteAsync(localBuffer, 0, numRead);
}
await memoryStream.CopyToAsync(stdIn);
await stdIn.FlushAsync();
}