Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good way of communicating between web and desktop app

I want my web app (running in a browser) to, at some point, communicate (bidirectionally) with a desktop app (in Windows), the client has installed in its computer.

What's an elegant and modular and simple way of doing this (with Java and C#)?

Not much information will be passed between the web app and the desktop app. Just something like "I was here", "Pick this from this point", etc.

like image 467
John Assymptoth Avatar asked Oct 10 '22 03:10

John Assymptoth


2 Answers

I solved that problem by using a database on the network. All communications where made trough the database.

Website -> DB -> User logged in <- DB <- Desktop

However, if no trusted information needs to be shared, you could consider just posting and reading some http headers to a common website, or a simple log file.

Greetings

like image 70
De ruige Avatar answered Oct 13 '22 10:10

De ruige


I suggest you to use the backend part of your webapp, assuming that your app is based on some backend services.

You have two options:

  1. Your desktop apps use the same services of your web app. You must use a class that mimic a web-browser to give the data (curl, ie). If your web app is based on AJAX push ( APE Server i.e ) use library that is able to run some javascript
  2. Use a REST protocol, with a JSON format in your backend services. It's easy to manage and is supported by many client-side languages (java/c#/python....)
  3. Use a specialized endpoint only for your desktop app,for C#, you can use WCF, that allow you, in one of his forms bidirectional communications. For JAVA, there are WSDL, DWR

My preferred solution is to decouple the web app in a front-end side and a backend side, that expose the services as REST that are used by the web app via AJAX.

If I need true bidirectional communication with other desktop app, I'll create a separate service / endpoint for it. (APE , WCF, ..)

like image 45
keatch Avatar answered Oct 13 '22 10:10

keatch