Successfully ran Shdr as an electron app. The issue was resolved by uncommenting a line of code that enabled creation of the browser window.
             

                  win = new BrowserWindow({width: 800, height: 600}) 

 

and giving the Shdr website url (instead of the path to the html file in the project directory) to the win.loadURL function in the index.js file.

I also installed and used electron-packager to generate an executable of the desktop based Shdr program. Running the executable generates the same browser window (showing the web based Shdr editor) generated through the command prompt. 

For Windows:

For Mac:

Next Step - how to make electron communicate with other desktop apps on the same machine using IPC (Inter-process communication)?

Solution: Node-ipc which is an Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP.

Windows sockets would be used as they "give lightning fast communication and avoids the network card to reduce overhead and latency."

        ipc.connectTo(id,path,callback);

Used for connecting as a client to local Unix Sockets and Windows Sockets.

However before delving deep into node-ipc, I decided to test a simple socket connection using the Node.js Net module which "provides an asynchronous network API for creating stream-based TCP or IPC servers." In order to do that I implemented a simple server in the processing tool template in eclipse and a client in Node.js using electron. The image below shows the server implemented in eclipse. The run function is called everytime a tool is opened in the PDE. Currently the issue faced here is that the server only responds if it is disconnected after receiving a message from the client. i.e if it does not listen continuously(in a while loop).

Below is the code for setting up a client in Node.js and sending a message 'world' to the server. For now the client has been implemented at the end of the index.js file which defines the startup script of the app.

Once the processing tool template with the server was compiled in eclipse, I ran the tool in the PDE.

GLSL Editor Weekly Report 2

05/27/2018
This site was designed with the
.com
website builder. Create your website today.
Start Now