Boom
Blazor server vs. Blazor web assembly + Minimal API
I mean if you're asking opinion on future. WASM seems like it'd be more popular as it keeps the load on the server smaller. Where server requires the server running the app for each user.,
88 replies
❔ Blazor Webassembly
like this
<div @ref="@context.ElementReference" class="panzoom" style="border-style: solid;width: 1000px; height: 1000px">
<img style="position: absolute; left: 100; top: 100; width: 100px; height: 100px" src="/Planets/star_blue01.png" />
<img style="position: absolute; left: 200; top: 200; width: 100px; height: 100px" src="/Planets/star_blue01.png" />
</div>
16 replies
Blazor server vs. Blazor web assembly + Minimal API
The main advantages to each I found are the following:
Server:
Download size is smaller because it runs on server.
The fact it's C# isn't served to clients so doesn't require browser supports webassembly.
0 offline support
Higher latency
Server runs everything so scales worse
Web assembly:
Download is larger as they have to download the app.
Browser has to support webassembly.
Can keep running without Internet after downloading the app.
Much work offloaded to client so less load on the server
Obviously in my research these are the things that influence my decision. But you may want to look at more factors.
88 replies
❔ Blazor Webassembly
full repo is here in case you believe it's project issues https://github.com/mwsaari/NotAStarWarsSim
But I believe I've pasted the relevant code.
16 replies
❔ Blazor Webassembly
<div class="canvas" style="border-style: solid;width: 500px; height: 500px">
<BECanvas @ref="_canvasReference">
</BECanvas>
</div>
@code {
ElementReference _planetImage;
BECanvasComponent _canvasReference;
Canvas2DContext _context;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if(!firstRender)
{
return;
}
_context = await _canvasReference.CreateCanvas2DAsync();
await _context.DrawImageAsync(_planetImage, 0, 0, 400, 400);
}
}
16 replies
❔ Blazor Webassembly
code
<div class="canvas" style="border-style: solid;width: 100%; height: 100%">
<BECanvas @ref="_canvasReference">
</BECanvas>
</div>
In OnAfterRenderAsync()
{
_context = await _canvasReference.CreateCanvas2DAsync();
await _context.DrawImageAsync(_planetImage, 0, 0, 400, 400);
}
16 replies