I have a web application running with support for some specific pieces of hardware. This is achieved in the following steps:
- User runs a small installer that places java files (and a couple others) on the client machine. The main piece is a jar called "hardwareManager"
- User visits web app. The web app runs a java applet which, due to a .java.policy file placed during the install, has permission to interact with the client machine outside the browser sandbox.
- The applet checks to make sure the hardwareManager is running, and if not runs a command to start it.
- User interacts with the web app which sends commands to the applet via javascript. The applet then writes commands to a text file on the client machine. The text file is constantly monitored by the hardwareManager which runs any commands it reads in.
This works, but seems clunky. I have a couple ideas on how to improve it, but I don't know which, if any, are even worth trying.
Would it be better to set up the hardwareManager as a socketServer and have the applet connect directly to it, rather than going through text files? Is that even possible?
Is there a way to eliminate the applet altogether and have the javascript talk directly to the hardwareManager? Maybe by writing the hardwareManager to be a local http server? What port should it run on? Do javascript xss limitations fit in here somewhere?