How to...

Referencing

The @interopio/desktop library is available as an NPM package which you can include as a dependency in your project and import in your code.

To install the @interopio/desktop library, execute the following command:

npm install @interopio/desktop

You can now import the factory function exposed by the library and start interop-enabling your apps:

const IODesktop = require("@interopio/desktop");

Initialization

If your Node.js app is started by io.Connect Desktop, it isn't required to pass authentication information in the optional configuration object passed to the factory function:

const IODesktop = require("@interopio/desktop");

// This will prevent the app from exiting when io.Connect is initialized.
// Remove in real apps.
setTimeout(()=>{
    console.log("Done.");
}, 10000);

const initializeIOConnect = async () => {
    // Optional configuration for initializing the library.
    const config = { appManager: "full" };

    // Use the object returned by the factory function to access the io.Connect APIs.
    const io = await IODesktop(config);

    // Here io.Connect is initialized and you can access all io.Connect APIs.

    console.log(`io.Connect version: ${io.version}`);
};

initializeIOConnect().catch(console.error);

App Definition

To add your Node.js app to the io.Connect launcher, you must create a JSON app definition file for it. Place this file in the <installation_location>/interop.io/io.Connect Desktop/UserData/<ENV>-<REG>/apps folder, where <ENV>-<REG> represents the environment and region of io.Connect Desktop (e.g., DEMO-INTEROP.IO).

The following is an example definition of a Node.js app:

{
    "name": "node-server",
    "type": "node",
    "service": true,
    "details": {
        "path": "%GDDIR%/PathToMyServer/index.js",
        "showConsole": true
    }
}

The "name", "type" and "path" properties are required and "type" must be set to "node". The "path" property points to a JavaScript file that io.Connect Desktop will execute in a Node.js environment.

For details on how to configure a remotely hosted Node.js app, see the Developers > Configuration > Application section.

For details on how to use different Node.js versions, see the Using Different Node.js Versions section.