-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending Messages to Ratchet server with Pawl #50
Comments
HI @Mrmrprofessional! It looks like your I hope this helps 👍 |
Hi,
Thank you for the response. It looks like the child process could be of great help. I figured out that the problem was that the command line was waiting for a user input even though it is not supposed to. I fixed the issue by adding &>/dev/null & to the end of the command.
Currently I am using Cron to run scripts at specified times that then establish a web socket client and send a message to the server when run. Would the child process or other component be able to call an event when Cron runs a script, or would I need to replicate cron in php in order for that to work?
Thanks for all the help
… On Jul 25, 2017, at 12:03 AM, Christian Lück ***@***.***> wrote:
HI @Mrmrprofessional <https://github.com/mrmrprofessional>! It looks like your exec() call blocks your event loop until it's finished and thus your server has no way of accepting any new connections until this script finished. As an alternative, you may want to use https://github.com/reactphp/child-process <https://github.com/reactphp/child-process> to execute a child process without blocking. This will also simplify reacting to when the script finished and you should no longer need your script to message back at all.
I hope this helps 👍
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#50 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ALoAbiOPw_8-RetB8ihDEANHk3ampawKks5sRZNKgaJpZM4Oh7oh>.
|
Depending on what you're trying to do a cron job may or may not be the best tool for the job :-) If it works for you, I see no reason to change this 👍 As an alternative, you may want to spin up a periodic timer to send your messages and perhaps keep the websocket client connection open. |
I am running a websocket server with Ratchet. The problem is when I have the server execute shell scripts based on incoming messages, I need there to be a way to let the server know that the script is finished executing. My solution was for the shell scripts to call a php script that sets up a client using pawl, and then sends a message to the server informing it of the completed task. Whenever I do this, the server hangs, and needs to be restarted. When I call php script directly from the command line, a socket is created, and a message is sent, but when the server calls the same script with "exec" or through executing a sh script which then calls the php script, the server hangs, produces no errors, and needs a restart. I imagine it has something to do with the client trying to connect to itself because when I use an invalid ip, it produces an error, but when I use the actual ip, it hangs. Please help.
The text was updated successfully, but these errors were encountered: