Long running processes #178
Replies: 6 comments 4 replies
-
FYI, the use case is to run a task that keeps a raw socket connection open and responds to messages and broadcast events to update the UI |
Beta Was this translation helpful? Give feedback.
-
Is your finding related to what i experienced (keep in mind, my laptop has very low specs)? |
Beta Was this translation helpful? Give feedback.
-
I've moved this to Ideas because I think there's a valid case for this as a feature, but NativePHP doesn't currently support this. First pass at this could be something in the NativePHP service provider that instructs Electron to spawn processes using the built-in PHP. Then as long as your script/Command that handles that execution runs in a loop, you could do whatever you want. e.g. in the service provider: public function startupProcesses()
{
return [
'artisan socket:listen -p 4444',
];
} In this, I'm imagining a Laravel Command class with the signature What do you think? |
Beta Was this translation helpful? Give feedback.
-
This is a great idea! In one of my projects, I have a file watcher that could use this. Ideally it would work like supervisord and restart the process if any error occurs. It would also be nice to start/stop/restart/status from other part of the code. In my example, the file watcher is started only after the user has configured the working directory. And restart it whenever it changes it. |
Beta Was this translation helpful? Give feedback.
-
This got raised again and is now in active development! |
Beta Was this translation helpful? Give feedback.
-
Our Child Processes functionality got released yesterday! |
Beta Was this translation helpful? Give feedback.
-
Hi folks 👋 !
Has any thought been put in to how we'd go about running long running processes or other background commands?
If I'm understanding whats happening correctly, it looks like the electron app is starting the task scheduler and queue worker when bootstrapping NativePHP https://github.com/NativePHP/electron-plugin/blob/main/src/server/index.ts?
Could we look to do something similar to run other daemon-like commands or processes?
Would love to help contribute if possible.
Beta Was this translation helpful? Give feedback.
All reactions