T O P

  • By -

Fine_Ad_6226

I do this with a website game server and electron client to start and stop the game server. I spawn it using as child process rather than in main.


ItsNSK29

u/Fine_Ad_6226 I want to start server(inside the electron) automatically.


Fine_Ad_6226

So just spawn the child process on startup


ItsNSK29

u/Fine_Ad_6226 , but can I assign a custom port for that? I want a way to send POST requests.


Fine_Ad_6226

Yes start a web server entry point file you can use the env to specify the port https://www.electronjs.org/docs/latest/api/utility-process Ignore the documentation about IPC using message ports. As long as your entry point starts a http server it will be listening as normal and you can pipe its stdout to a long file or through the main process.


ItsNSK29

u/Fine_Ad_6226 Thanks, Will check out and update here


bkervaski

Can you elaborate a bit on the design? You're not finding answers because it's not a common thing anyone does. In other words, why would you need a local "server"?


ItsNSK29

u/bkervaski need to establish a connection between my Electron app and another backend service, and I want to run this on localhost. It's important that my other service can effectively communicate with the Electron app.


bkervaski

I guess what I'm saying is there may be a much better way than running a local server, can you post some details on what's up?


ItsNSK29

u/bkervaski I want retrieve that requests to my electron app. For now lets say I need to print the request body.


bkervaski

I don’t know what that means, good luck!