3

I have two application , App1 and a App2 running in windows7 client context.

App1: List files. and allows user to select a file and trigger load file to App2. This is HTML5 application ( Angular 2) hosted in IIS.
App2: Allows to view the files. Native C++ application. 

I would like to send the specific selected file details from App1 to App2. I have tried following callup options:

  1. ActiveX control:

    App2 is an activeX control and App1 basically invoke a ASP page which internally runs a java script to load the App2 ActiveX and transfer the details. But this works only for IE. No regular fix for the other web Browsers .

  2. Web sockets:

    App2 hosts websocket server and App1 angular app invoke web socket API to transfer the data to App1. This forces me to host webserver code in client machine, which is not so good IMO.

What are the other options available to transfer data from HTML5 application to the native application running under client context?

Kinght 金
  • 17,681
  • 4
  • 60
  • 74
aJ.
  • 34,624
  • 22
  • 86
  • 128
  • When you say that App1 can "list files", are you referring to files on the local filesystem? Also, are App1 and App2 located on the same machine, or potentially separate machines? – MrEricSir Dec 21 '17 at 04:28
  • App1 lists files in a UI. just a abstraction. In actual product, it does more than "local file system". both client machines will run on a single client machine, one with webbrowser and other one directly on client machine. – aJ. Dec 21 '17 at 06:50
  • What kind of files are you trying to transmit from App1 to App2? – diogenesgg Jan 19 '18 at 04:05
  • Hosting simple http server does not look bad to me. You can host very simple http listener. Not websocket, just http listener and perform POST request(s). E.g. you can use HttpListener from .NET. – Stanislav Berkov Jan 19 '18 at 09:37

2 Answers2

0

You can use Chrome Native Messaging API. See example here: https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/docs/examples/api/nativeMessaging

To try the example: (You'll need python installed for this example to work.)

  1. download the example from the link above
  2. register the host with install_host.bat
  3. enable developer mode in chrome://extensions/ and load the unpacked extension from /app directory
  4. go to chrome://apps/ and launch the Native Messaging Example app
  5. Press connect

If all went well, the app will start and you'll be able to exchange messages between Chrome and the app.

enter image description here

Now replace native-messaging-example-host.bat with app2.exe and adjust scripts accordingly.

Hope it helps. :)

Laszlo
  • 769
  • 9
  • 19
0

As taken from this answer,

You want to create an Asynchronous Pluggable Protocol Handler.

Here is a guide to registering an Application Protocol.

diogenesgg
  • 2,601
  • 2
  • 20
  • 29