-
Notifications
You must be signed in to change notification settings - Fork 283
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
Process does not terminate #253
Comments
Not possible with current's Websocat1, possible in future's Websocat4 using custom scripts. Here is example of connecting to
Both connections will fight for input from stdin though. You can get script samples using But just like with your existing solution, "I have concerns that data from site.com/1 and site.com/2 may arrive at the same time." is still a problem and can lead to garbled data. I'll probably add accurate combinator to Websocat4 later (or maybe sooner, if you are open to alpha test it). As for exiting, you may put all the processes into process group and terminate the whole process group later. |
Thanks for the example, but I'm afraid I don't know the Rust programming language and I may be less useful than you expect. But I'm willing to make an effort to help you with alpha testing if you accompany me during the testing process and provide feedback.
I tried to do it like this: But in my case it didn't work. Please could you explain in more detail? |
Here is a Bash command line that force termination of a backgrounded process:
Note that if you just need to send a message to other URL (without keeping subscribed for further replies), you may use |
Hi Vi! I've been racking my brain trying to find a solution, please help me. I need to pass some text to the websocat utility via "echo" and establish a connection to the first address, then make another connection to the second URL and redirect websocat to redirect the stdout of both processes to
php file.php
.I came up with a solution, but it doesn't work correctly:
(echo "test" | websocat -n wss://site.com/1 & websocat wss://site.com/2) | php bot.php
But the problem is that when the "php bot.php" process terminates, the
websocat wss://site.com/2
process continues to hang in memory (because the server doesn't close the connection), and I need all processes in this expression to terminate.When the
php bot.php
process terminates, I see the following message in the console:Exit: disconnected
Exit: disconnected - indicates that the php bot.php process terminated its work using the exit() function;
At the same time, as I already said, the
websocat wss://site.com/2
process continues to hang in memory and continue its execution in the console, which I can only do with CTRL+C or Enter key.All I need is that when the php bot.php process terminates its work, all websocket connections are also closed and websocat processes are also terminated correctly.
I noticed that if after the completion of the php process, data from the server comes to the
websocat wss://site.com/2
process via websocket, then websocat terminates its work, albeit with error messages in the console.PS: I am not completely sure about the correctness of the construction
(echo "test" | websocat -n wss://site.com/1 & websocat wss://site.com/2) | php bot.php
I have concerns that data from site.com/1 and site.com/2 may arrive at the same time. For example, site.com/1 sends "Hello", and site.com/2 sends World, and the PHP script may output HeWorldllo. It would be easier if websocat could work with two connections at once, but I did not find such information in the documentation
Perhaps in this case it would be more correct to create a websocat server and connect to it websocat wss://site.com/1, websocat wss://site.com/2 and through another websocat instance directly the php bot.php script itself
The text was updated successfully, but these errors were encountered: