locked
blazor application architecture RRS feed

  • Question

  • User1072303328 posted

    Still a total noob to Blazor.  Trying to figure out if the following is possible. Or maybe am I crazy for trying to mash this altogether with blazor?

    Customer:

    • a Progressive Web App for mobile
    • using most (or all?) of the same code for a server based web app for the customer who doesn't want to install a PWA 

    Backend/Business:

    • back end server part of the application to handle business and admin functions
    • A PWA for backend users for certain functions

    There PWA functions would do API calls, while the server parts could call the business layer directly.

    Would authenticate the whole works with a mix of Identity (customer, external business users), OAuth (customer) and ADFS (business users only).

    Was originally doing to native iOS/Android apps but building and deploying to the app stores is a pain in the ass.   The only thing the PWA's need from the mobile hardware is location, which I believe is possible.  No local database or anything needed. 

    Wednesday, March 25, 2020 8:47 PM

All replies

  • User-474980206 posted

    Blazor is a web assembly, not a PWA. as a PWA can reference a web assembly you can build one with blazor. see docs:

       https://docs.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app?view=aspnetcore-3.1&tabs=visual-studio

    PWA's are hosted by the browser, and include a manifest and a server worker that caches the assets, including any web assembly used. PWA's run in a browser as a normal web site if not installed as a PWA. In no way is blazor required to write a PWA.

    almost all mobile browsers support location services (but the user needs to approve for the site). also Blazor would need to call a javascript routine to get the location, as its not supported by web assemblies.

    note: blazor app is web assembly hosted by the browser. there is page on the site that hosts the javascript used by blazor app and references the blazor web assembly. web assemblies can not access the dom, nor make network calls. they call javascript routines to do this. they also do not support threading.

    the main point of PWA is to support off-line mode. This is where the service worker code (written in javascript) comes in. unlike a web assembly, a service worker can access the network and intercept all network requests (from its site pages). it can also access local storage. Typically local storage is used to cache data when the network is not available. when the network become available the service work can sync the data. a service worker can run even when the site page is not loaded in the browser.

    Wednesday, March 25, 2020 10:45 PM