Build a Node.js app with Formant functionality

📘

This page assumes knowledge of JavaScript, TypeScript, Node.js, and Playwright. For information and documentation on the Playwright package, see the Playwright website: Playwright.

You can use Node.js to build a JavaScript application which programmatically opens a teleoperation connection to a Formant device without using a browser-based UI.

On our GitHub page, you can find an example which establishes a teleoperation connection to a Formant device and reports the ping between the server running the program and the device: GitHub: node-data-sdk.

When using this example, you can modify the Data SDK functionality in /src/web/user.js. At runtime, this script is injected into the index page. index.html is then served to a headless web browser via Playwright. The presence of this headless web browser gives the app access to the WebRTC API, which Formant uses to create a teleoperation connection to a device.

Logs from the web browser are parsed in the page.on('console', (message)) structure and reported in the terminal. Functions from user.js can be called in Node.js using the page.evaluate() function.

👋

If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].