Tobias Madsen
Tobias Madsen

Reputation: 39

Blazor server pwa

I am trying to find out if it's possible to make a PWA with Blazor server.

It seems to me the way some are "solving" it , is by copy pasting the manifest.json from a webassembly app to a server app.

This made me wondering, why does Microsoft not provide a --pwa flag on the dotnet run blazorserver but only on the web assembly if it's as simple as that.

Thanks!

Upvotes: 2

Views: 2127

Answers (2)

Coden
Coden

Reputation: 2868

Here you could find a small tutorial how to add the PWA functionality to a server side project: blazor-server-progressive-web-app-tutorial

Basically it is only adding the manifest and service-worker.js

Upvotes: 0

Nijenhof
Nijenhof

Reputation: 692

Essentially yes: it is possible. But the only benefit you get by doing this is being able to install the application on a device. As Mayur Ekbote stated, blazor server runs on the server and can therefore not access all the other features provided by a PWA. This also explains why Microsoft has not provided a --pwa flag, it's essentially useless. Though I suppose the install feature alone might be worth making it a PWA.

If you want to make your blazor server a PWA, you need to have both a manifest.json and a registered service worker. The browser won't pick it up as a PWA otherwise. For more expansive installation requirements, check this.

As you already described, the easiest way to do this is to copy over the service worker and manifest from a webassembly project and add it to the server project.

Upvotes: 5

Related Questions