Search code examples
c#.net-coreblazor

Blazor: Interactive WebAssembly or Interactive Server


For my next project I decided to use Blazor. I read the docs on .NET 9 Blazor which states that there are different rendering modes, the 2 most relevant for me is Interactive Server and Interactive WebAssembly.

From my understanding its possible to call the service layer directly in the case of Interactive Server. Are there any downsides to using just this, or I will be better of with building out API's and using Interactive WebAssembly?


Solution

  • When using the Interactive Server mode, the communication between the client and the server is real-time, all processing is done on the server, and SignalR is used to connect to dynamically update the user interface. Because server-side rendering is performed, the initial loading time is relatively fast and the amount of data transferred is less. However, since it requires a continuous connection to the server, network latency or server load may affect responsiveness.

    When using the Interactive WebAssembly , the application is executed directly in the user's browser. After the application is loaded, it can run on the client to support offline scenarios, which can reduce server load, but the startup time may be longer than the server because the entire application is initially loaded.

    At the same time, when using WebAssembly, you may need to build an API to handle data requests, which increases the development workload but provides better scalability and lighter server burden.

    You can choose Interactive Server based on your situation if your application requires real-time communication and the server load is not large. If you need faster response time and offline support, Interactive WebAssembly may be more suitable.

    For more details, you can refer to the document .