I’m working on a project that needs a Node.js server to control two separate screens connected to the same machine. Here’s what I’m trying to do:
The server runs on a Windows PC with two monitors hooked up. Each screen needs to show different content, but it all comes from the same Node.js app. I can’t use a regular web-based setup because the screens need to be physically connected to the server machine.
I’m not sure how to make this work. Should I:
- Make a custom program with two plain windows and embedded browsers, then have Node control those somehow?
- Build an app (maybe with a game engine) that takes commands from Node to update the screens?
Has anyone done something like this before? What’s the best way to get Node to manage two physical displays with different content? Any tips or ideas would be really helpful!
// Example of what I'm thinking about
const screen1 = new Display('screen1');
const screen2 = new Display('screen2');
screen1.show('Welcome to Screen 1');
screen2.show('This is Screen 2');
// Update content dynamically
setInterval(() => {
screen1.update(getScreen1Content());
screen2.update(getScreen2Content());
}, 5000);
Thanks for any advice!
hey there! maybe try nw.js? it’s like electron but simpler. you can open separate windows per display with node. i wonder, what’s the main content you’ll show? i’d love to hear more about your project!
For your dual-screen setup, I’d recommend exploring the Electron framework. It’s designed for creating desktop applications using Node.js and web technologies, which aligns well with your requirements. Electron allows you to create multiple windows, each of which can be positioned on different screens and display unique content.
You can use Electron’s BrowserWindow API to create and manage separate windows for each screen. This approach gives you fine-grained control over the content and positioning of each display. Additionally, Electron’s IPC (Inter-Process Communication) mechanism enables seamless communication between your Node.js backend and the front-end displays, allowing for real-time updates and synchronization of content across screens.
By leveraging Electron, you can maintain the flexibility of Node.js while gaining the ability to interact directly with the operating system’s display capabilities.
hey climbin monkey, i’ve done smth similar. electron is ur best bet for this. it lets u make desktop apps with node.js and html/css. u can create 2 windows, one for each screen, and control em separately. its pretty straightforward to setup and gives u lots of control over the displays. goodluck with ur project!