Last post Sep 25, 2020 02:36 PM by bruce (sqlwork.com)
Sep 24, 2020 10:08 AM|dfenton|LINK
I have a Blazor WebAssembly application. One of the server side methods, which is called after a button is clicked on the UI, creates a number of database records but for various reasons this process can take up to a minute. During this time, the UI isn't
providing any feedback to the user until the task is fully completed.
Is it possible with Blazor WebAssembly for this task to be running whilst the client side sends regular requests to the server to get data on the progress of the task (which I can get via SQL).
If this was a console or WinForms application. I'd probably split the main task and the progress updates into two seperate threads but I'm unsure if this is the right way to do it with Blazor WebAssembly. If I can use multithreading here, should it be done
on the client or server side? If multithreading isn't possible here, is there an alternative way to achieve this desired functionality in Blazor WebAssembly?
Any advice would be appreciated. Thanks.
Sep 25, 2020 10:12 AM|ammd|LINK
You could have an indicator on server side that keeps track of whether your task is complete or running (example, simple db table) and then use blazor to periodically poll that table and get status.
Sep 25, 2020 02:36 PM|bruce (sqlwork.com)|LINK
You have several options
the second is to use a signal/r connection. Use signal/r to make the request to hub routine, that updates the database and sends status messages to the client.