I'm new to SignalR, and I'm trying to find a way to discover and print, client side, the size of the received message.
orderHubConnection.On<OrdersViewModel>(Message.OrdersUpdate.Value, model =>
{
// How to obtain size of "model" here?
HandleOrdersUpdate(model);
});
When I work with Web API, I can access to the ContentLength like this
response.EnsureSuccessStatusCode();
if (response.IsSuccessStatusCode)
{
OrdersModel = await response.Content.ReadAsAsync<OrdersViewModel>();
OrdersModelSize = response.Content.Headers.ContentLength;
}
but in SignalR the message I receive is already deserialized, and it's hard to find the size of the received content.
Anyone experienced the same need? Following link asks pretty much the same question
Core SignalR message sizes - is there a way to log how large your messages are?
Thanks!