System.PlatformNotSupportedException with Server Events on Blazor WASM Project

I’m getting the following error when attempting to use the ServerEventsClient in a Blazor WASM project:

Is this a webassembly limitation, or something we can work around?

not doing anything exotic when setting up the client in my razor page, I don’t think:

Yeah it’s a WebAssembly limitation, it’s unlikely any network client libraries are going to work in a WASM browser, only the whitelisted clients we’ve included in the templates, e.g. as we’ve done with AddBlazorApiClient().

You wont be able to use the C# client, the only workaround is to use the TypeScript Server Events Client in your Blazor’s static /wwwroot/index.html and include the necessary interop to call C# APIs from JS.

ok great - thank you for the quick response. I’ll try the workaround and see if I come right…

quick additional question: does gRPC Server Events work through webassembly? Or will it face the same limitation?

Wont know what will or won’t work in Blazor until it’s tested, but WASM can’t escape the web sandbox and it wasn’t possible to consume gRPC server stream without going through gRPC Web proxy so I don’t expect the C# ServiceStack.GrpcClient library to work since it doesn’t have access to raw TCP sockets.

hmmm…ok. Thanks for the insight, sir.