I have created simple Blazor WebAssembly project under .Net 6.0
I have tested different client channels for access to Remoting SDK Server: IpHttpClientChannel (.NET) WinInetHttpClientChannel (.NET) IpSuperHttpClientChannel (.NET) WinInetSuperHttpClientChannel (.NET)
None of them work with different errors (Operation is not supported on this platform):
System.Threading.Thread.Start()
System.Net.NameResolution
System.Net.Sockets
Is it possible to use any .NET Client Channel under Blazor WebAssembly?
I found Data Abstract and Blazor
looks like this example use JavaScript Client Channel Component
The example mentioned is Blazor Server-Side. The issue is that Blazor ServerSide and Blazor ClientSide are completely different platforms, despite similar name and exposed API.
Blazor ClientSide is a very limited platform with a crippling limitation: it is strictly one-threaded, at least in NET 6. So none of the existing client channels is expected to work on Blazor Client.
At this time the best available solution is to expose service methods via HttpAPI ( HttpAPI ). Please note that adding HttpAPI support to the server does not require any changes in the existing clients. It is just one additional endpoint added to an existing server that allows clients to communicate using Http + JSON
I was able to access RO SDK server after I added these options to its startup code:
server.NetworkServer.ServerChannel = new IpHttpServerChannel { SendCrossOriginHeader = true };
server.NetworkServer.ApiDispatcher = new HttpApiDispatcher { ApiHost = "http://localhost:8099" };
In other words I enabled CORS on the server channel (otherwise Blazor app won’t be able to fetch data).
Then I added HttpAPI dispatcher and configured its ApiHost property (it is the address of the server that should be used by clients to perform calls)