The Documentation Of MessagePack for C# states that using LZ4 compression you can achieve compact binary sizes of your payload. in docs you can use:enter code here
var lz4Options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray);
MessagePackSerializer.Serialize(obj, lz4Options);
So it basically says that upon calling every Serialize() and Deserialize() methods, you should specify compression options exclusively.
But when working with .NET Signalr, you don't directly call these methods. Nuget Package Microsoft.AspNetCore.SignalR.Protocols does that for you. you only have to tell the applications serviceCollection to do so in ConfigureServices() method:
public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR().AddMessagePackProtocol();
}
So I'm curious how to specify MessagePackSerializationOptions for signalr to use LZ4 compression. I already tried changing default option configuration in applications main method:
MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray);
But firstly it isn't recommended and secondly It doesn't seem to work :D