Hello, fabulous Syncfusion, Blazor & SignalR gurus!
I aim to add (hopefully compressed) binary messaging between my ASP.NET Core server with SignalR and my Blazor WebAssembly.
Messaging is fully operational in both directions but I notice in the browser's network monitor that the websocket used by SignalR still sends its messages via JSON and Base64. Not only is my stream not compressed as configured server-side but Base64 throws away 2 bits out of 8 yielding a pipe efficiency decrease of around 28%.
As recommended in the above instructions, here is my current code in my server-side WebApplication builder:
builder.Services.AddSignalR()
.AddMessagePackProtocol(options => {
options.SerializerOptions = MessagePackSerializerOptions.Standard
.WithResolver(MessagePack.Resolvers.StandardResolver.Instance)
.WithSecurity(MessagePackSecurity.UntrustedData)
WithCompression(MessagePackCompression.Lz4Block)
WithCompressionMinLength(256);
});
However, the same instructions mention to add the following to my '.net client'...
var hubConnection = new HubConnectionBuilder()
.WithUrl("/chathub")
.AddMessagePackProtocol()
.Build();
Unfortunately, the sample I've been basing my WebAssembly work on has no concept of a HubConnectionBuilder object and creates its builder as follows:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
Trying everything I could think of, I cannot find a way to find a sub-object of 'WebAssemblyHostBuilder' where I could call the 'AddMessagePackProtocol()' so that MessagePack also works client-side
My hunch is that the server side is properly configured for (compressed) MessagePack but the web-assembly client is not, so I still get JSON + Base64 messaging. (I can live without compression support within MessagePack but would like to lose the 28% pipe efficiency drop caused by JSON + Base64)
Key questions:
Q1: Is MessagePack supported in Blazor WebAssemblies?
Q2: What is the proper procedure to configure the SignalR pipe within Blazor WASM to use MessagePack?
Q3: Is MessagePack the highest-performance pipe for my client/server architecture?
Thank you very much for any hint you can offer!
Jean-Pierre