Comments (9)
What do you mean by "not working"?
Variants:
- websocat does not start
- websocat starts, but exits early
- websocat starts and connects to the socket, but xargs finishes early
- both websocat and xargs persist, but xarg does not start any new processes
- xargs starts child processes, but it does not work properly
?
Typically I use strace
tool to debug what is happening, including for backgrounded processes.
from websocat.
From Crontab
- both websocat and xargs immediately exits
From nohup
- both websocat and xargs shows up (under ps -eaf command), but they don't work as expected. I would like to invoke
print_args.sh on each message received.
I suspect it is not able to pipe correctly in the background.
Instead if use a similar tool like netcat (for send/receive)
works consistently across interactive shell, nohup or crontab.
-
sender_nc.sh:
nc 127.0.0.1 9000
x
y
z -
receiver_nc.sh
nc -l 9000 | xargs -r -n1 print_args.sh
from websocat.
Note that you may want try foreachmsg:
overlay if you want something to happen on each message. Something like
websocat -E -k -t wss://127.0.0.1:9000 foreachmsg:cmd:./print_stdin.sh
from websocat.
foreachmsg:cmd immediately exits as reported earlier by other people.
All 3 scenarios are shown in the screenshot attached.
- without xargs or foreach
- with xargs - only works in interactive shell
- foreachmsg - exits immediately.
For now I ended up writing another websocket client to execute the command after receiving the message (in background). this is not ideal but not a deal breaker either. Atleast I was able to run web socket server and sender without writing code. It is only the receiver part which doesn't seem to work in background mode.
from websocat.
Note that instead of broadcast:mirror:
it may be better to use wsbroad.
from websocat.
Tried some command lines: foreachmsg:
exists as it tries both directions by default (data transfer to WebSocket and from WebSocket) and -E
commands it to exit if any of that direction finishes. But reverse direction (to WebSocket) finishes immediately in some cases, as stdin is not available in those modes.
Maybe you want -un
instead of -E
, i.e. use only one direction (from left to right) and prevent sending quit message.
Also you need to modify print_args.sh
for foreachmsg:
- the data will be on stdin, not in argv.
from websocat.
Note that instead of
broadcast:mirror:
it may be better to use wsbroad.
I'm running this in production from last 3 weeks weeks. On an average it crashes once every 24 hours without providing anything in stdout or stderr. I have written a crontab script that runs every minute and if websocat server is down it simply restarts it. Therefore it is not causing a serious problem. However do you think wsbroad is more stable than running websocat with broadcast:mirror. Is there a known problem?
from websocat.
Websocat is not expected to require periodic restarts. Maybe something wrong is happening? What do you mean by "crashes"? Process exits? (with what exit code?). Is it a high-load scenario or Weboscat is mostly waiting?
However do you think wsbroad is more stable than running websocat with broadcast:mirror
It is much simpler than Websocat and it uses modern dependencies (tokio-tungstenite).
Note that it differs from broadcast:mirror:
- each seen URL gets a separate broadcast domain instead of being ignored like in Websocat. You can also tune some options of how messages should be forwarded.
from websocat.
load is very minimal hardly 100 concurrent subscribers. yes process exits without writing anything to stdout or stderr. i'm redirecting both 1 and 2 to a file. unfortunately core dump is not enabled on production server which could have revealed the actual cause of the problem. it is very hard to reproduce the error. i will replace websocat with wsbroad and see how it goes.
if you want to close the issue please feel free to close it as i'm not able to provide any stack trace because core is not enabled on production server. i use the websocat behind haproxy tunnel not sure if this matters. reason haproxy is used to provide consistent ssl connection on 443 port.
Once again thank you for all the help and great work.
from websocat.
Related Issues (20)
- provide interface that accepts `Opts` and `std::process::Stdio` HOT 3
- Binary response frames are not handled well HOT 5
- Binary Frames support HOT 8
- websocat.x86_64-unknown-linux-musl on Ubuntu is seems to end before a message is received? HOT 4
- Specify server TLS certificate HOT 2
- "dropped a ping request from websocket due to channel contention" HOT 2
- Specify TLS hostname separately from connect hostname HOT 2
- Refersh header while interractive session is in progress HOT 15
- Question: how do websocat know the other one reached EOF ?
- How do websocat know the other one reached EOF ? HOT 3
- Print more details on I/O failure
- websocat does not report errors when the connection dies HOT 1
- Is there any way to print plain text of request and response when connecting to wss endpoint ? HOT 1
- Pkcs12 compatibility issues on OpenSSL 1.x.x HOT 5
- Consider allowing basic auth to be passed in environment variable to hide it from the rest of users HOT 4
- Saving Response from Websocat on windows OS HOT 1
- [v1.13.1] Release Date Request HOT 3
- Websocat client cannot connect even though wscat does? HOT 2
- pipe commands to websocat? HOT 3
- Cannot install in Fedora 40 container HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websocat.