Simultaneous Blazor Hosting Models and switching at runtime
See original GitHub issueIs your feature request related to a problem?
I would like to host my blazor application differently depending on client attributes and needs, but it appears I must choose between server or client.
Describe the solution you’d like
Ideally it would be interesting to have a bootstrap step on the initial load that can decide whether to run the application in server-side mode or wasm mode from the client. For instance, perhaps I check a localstorage
variable to see if I have already loaded the version of the wasm bundle I need. If so, I’ll go ahead and run as wasm, otherwise I can choose to run as server-side for a quicker startup.
In addition, if I choose to run server-side, I can also choose to request the wasm hosting bundle in the background. The idea being, while the client is up and running on the server-side hosting, the application is preparing itself to be able to switch to wasm mode once all the resources are downloaded.
The end result is an attempt for a best-of-both-worlds scenario. You get the speed of a quick server-side startup and the flexibility of a full wasm hosted application without changing the experience for the user.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:7 (3 by maintainers)
Top GitHub Comments
I’m building a solution that uses server-side blazor at first while loading wasm blazor in the background, and when wasm resources are ready, switch the server-side blazor to wasm blazor at the runtime. I can already achieve switching hosting model at the runtime, but I am struggling with keeping the previous states (both the application states and render tree) after switching. I hope blazor can add support for passing states and render tree from server to client and applying them to the client.
Check this repository description