I have run into a problem where my websocket connection is functioning as expected locally, but not when deployed to azure app service. (.NET Core 3.0)
I am able to receive messages of any size locally, but the messages cap out at 4088 byte when deploying to azure.
Code example:
await Receive(socket, async (result, buffer) =>
{
Console.WriteLine("Message size: " + result.Count);
message = Encoding.UTF8.GetString(buffer, 0, result.Count);
});
private async Task Receive(WebSocket socket, Action<WebSocketReceiveResult, byte[]> handleMessage)
{
try
{
var buffer = new byte[1024 * 16];
while (socket.State == WebSocketState.Open)
{
WebSocketReceiveResult result = null;
using (var cts = new CancellationTokenSource(1200000))
{
result = await socket.ReceiveAsync(
buffer: new ArraySegment<byte>(buffer),
cancellationToken: cts.Token
);
}
handleMessage(result, buffer);
}
}
catch (Exception ex)
{
Log.Error(ex, "Exception occured when receiving message async");
}
}
Is there any kind of limit that can be changed in the app service?
I have already tried to set up a remote client sending messages both to azure app service and my local environment. This is only an issue with azure app service.