I’m working on a project with three parts: a desktop app, a server backend, and a web frontend. Right now, I’m using websockets for the desktop app to talk to the backend, and for the backend to talk to the frontend. The frontend is a single-page app.
Here’s what I want to do: I need the desktop app and web frontend to talk directly. I could use the backend as a go-between, but that would use up server resources. Is there a way to set up a direct link between the local desktop app and the web frontend?
I’m coding the desktop app and backend in Go, and the frontend in JavaScript. I’d love to hear any ideas about how to set this up, even if they’re not specific to these languages.
// Example of current setup
desktopApp.connect(backendServer)
backendServer.connect(webFrontend)
// What I'm looking for
desktopApp.connectDirectly(webFrontend)
Has anyone done something like this before? What approaches worked for you?
For a direct connection between your desktop app and web frontend, you might want to explore using WebSockets in peer-to-peer mode. This approach allows direct communication without going through a server intermediary. You’d need to implement WebSocket support in your Go desktop application and set up a WebSocket client in your JavaScript frontend.
To establish the connection, you could use a signaling server for initial handshaking, then switch to direct communication. This method maintains low latency and reduces server load. Keep in mind potential security considerations and ensure proper authentication mechanisms are in place.
Another option is to investigate Progressive Web Apps (PWAs) which can bridge the gap between desktop and web applications, potentially simplifying your architecture.
have u considered using WebRTC? it allows direct peer-to-peer communication between web browsers and desktop apps. might be worth looking into for ur project! how important is real-time communication between the desktop app and frontend? any specific features you’re tryng to implement?
hey, wht about using electron for ur desktop app? it lets u build cross-platform apps with web tech. u could use IPC (inter-process communication) to connect the desktop part with the web frontend directly. might simplify things. hav u looked into that option?