How can the backend notify the UI? - ASP.NET
I have 2 disconnected components - a website and a background process. When a user submits a long running request, its added to a database table that a process picks up for further processing and sets a bit flag in the table.
While this is happening, the user is waiting for the process to be completed. I understand I can poll the 开发者_C百科database every X seconds to verify if the processing is completed. This works but I'd like to make this more performant.
Is there a way for the backend to notify the UI that a process has been completed?
PS: If I need to use MSMQ, I guess I can do that too. I am not sure if it helps in this scenario.
The web site would need to check the database via ajax (or just reload the page). You can't have the server connect to someones computer and to tell them it's done. That would be a huge security issue.
If you use ajax to do this, the requests could be very small and probably wouldn't affect your application performance wise in a noticeable way.
The cool kids these days are creating these channels using HTTP Streaming. This is probably overkill for your scenario, a quick and easy ajax request will probably get you there.
精彩评论