How can I get a desktop application to tell a webpage to refresh an element?

96 views Asked by At

I have a web application, running asp.net mvc 5. On one of the webpages I have a link that calls a protocol handler that tells the client to run a desktop application, which is a WPF application, that is located on the client's computer.

The desktop application on the client's computer takes a screenshot of the client's desktop and puts it into a shared folder on the network. That part works fine.

The problem is that I'm not sure how to get the desktop application to notify the web application when it has completed it's task in such a way that will allow the web application/browser to refresh an <img> tag to show a preview of the screenshot.

I know I can send an Ajax request to check the folder, but there is a chance that the ajax request could finish before the desktop application has a chance to finish. Does anyone have any suggestions?

1

There are 1 answers

0
earthling On

I have a similar situation. How I've handled it is by setting up a web service for communication or beaconing that both the desktop and website can communicate through.

When you launch your app from the browser, include a unique key in your custom protocol url that would be shared with the browser and the desktop apps. Then call this new beaconing service with status updates from your desktop app while poling from your web app and acting on whatever status updates you need to.

Does this make sense?