質問

The requirement is to provide duplex communication methodology between .net client application which is a windows application and javascript application, which runs on the browser.

Flow is 1. User installs the client app on their machine. 2. User visits the website and logs in to the portal which hosts the javascript app. 3. If the user performs an activity on client .net app, javascript app requires to be notified. 4. If the user performs an activity on the javascript app on the browser the .net client application has to be notified.

Possible solutions tried out are 1. Web server .net client app, where javascript app connects to using web sockets. However given the .net client app might start the webserver on a different port than originally intended, if the ports in use, the javascript app might not be able to identify the port the web server is running on. 2. Have an activeX running on the javacript app. Both the active X and .net app will connect through local named pipes through WCF. Bad part is use of active X will show a pop up soon as you load the web application.

Would you know of a better solution for the problem?

役に立ちましたか?

解決

We've successfully used WebSockets for duplex communications between in-browser Javascript and an external app running a WebSocket server. It's efficient and (at least as of last year) bypassed all browser sandbox restrictions. I'm not 100% understanding this part of your question:

However given the .net client app might start the webserver on a different port than originally intended, if the ports in use, the javascript app might not be able to identify the port the web server is running on

The .NET app can run a socket server on any port it wants. If you are writing both apps, I'm not seeing how synchronizing on a specific port would be an issue? Worst case scenario the desktop app could write the port to local storage, which your JS can grab via local storage. There are other ways to synch this as well.

他のヒント

SignalR is a communications API that has client libraries for both .NET and javascript, and the server library is built on the ASP.NET stack.

With it, you can build a solution that allows client (js) <-> server <-> client (.NET) communication.

Here are some useful links to get you started:

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top