3

Is there a way to call an external program on client side and "talk" to it?

For example, if I have a Node.js serverving an AngularJS or any other framework, I want the user to press a button on the browser and a previously installed program on client-side starts to run and send back to the client some messages...

Can I achieve that?

6
  • You can if you also code the client-side application and an extension/plugin for the browser used by the user to make your webapp talk with the desktop application. Commented Nov 23, 2015 at 14:26
  • 2
    One way to do something like that would be via a custom protocol link that is set up when the application is installed. For example, you can launch the steam friends window via a link like so steam://friends. The user has to allow this action. As far as running an arbitrary executable on the users' machine, no that is not possible (nor secure). Commented Nov 23, 2015 at 14:28
  • I would consider a combination of socket.io and the node process require('child_process').exec. The latter has event emitters that you could easily wire up to the socket to track progress of the native executible Commented Nov 23, 2015 at 14:41
  • @ShanShan I was actually wanting to run away from extensions for their instabilities... Commented Nov 23, 2015 at 14:46
  • @Joe I thought of that, but then the process would run in the server side, wouldn't it? It'd just be called by the client. I want the process to run on client side computer. Like a C++ application. Commented Nov 23, 2015 at 14:47

4 Answers 4

4

Browsers cannot run executables on the local machine without explicit configuration as such behaviour would violate security restrictions.

Node.js can do anything that is permitted by the environment (e.g user permissions) in which it is run. See: https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

Sign up to request clarification or add additional context in comments.

Comments

1

Consider using Native Client

Native Client is a sandbox for running compiled C and C++ code in the browser efficiently and securely, independent of the user’s operating system. Portable Native Client extends that technology with architecture independence, letting developers compile their code once to run in any website and on any architecture with ahead-of-time (AOT) translation.

In short, Native Client brings the performance and low-level control of native code to modern web browsers, without sacrificing the security and portability of the web.

https://developer.chrome.com/native-client

Comments

1

This is certainty possible in many different ways.

One sort is using node webkit.

Another,a NPM package called Edge. This is sort of like a bridge between node a .net. Or more specifically node and a clr process. You can execute c# statements and load assemblies in a clr process and interact with it in javascript via node and Edge.

https://github.com/tjanczuk/edge

Comments

0

I think that the better form to do that is using API REST, you can create your server API in node JS for example and use AngularJS to consume that services in the browser and JAVA or .NET for the Desktop app

the following is a simple Example using Node and Angular

4 Comments

I get the use of Node and Angular. But how can I make them (especially the client side) talk with the JAVA or .NET?
to use the framework of :NET or program a WEB application in JAVA you need experience, is so difficult usinng only a tutorial esplciali because many of they are for browser app not Destok; why you need that the client app not run in browser?
I need the webapp to exchange messages with a desktop c# app. I need some information stored in the computer that Javascript is not able to get :/
if the information are in one folder you can use javascript and run the app in the client side (in the folder where you have information that you need) in this case you can be acces to information in client side, if you know C# you can use .NET is a framework for C#

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.