-
Notifications
You must be signed in to change notification settings - Fork 278
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
Output of received messages to stdout truncated to 1024 bytes #76
Comments
Are there no warnings issues to console? The behaviour looks like what message-to-line convertor in WebSocat does (but default buffer size is 65536, not 1024).
Maybe current terminal became non-blocking? Does running just This snippet would help removing non-blocking mode from current terminal:
(or just reopening it) Websocat typically switches stdin/stdout to nonblocking mode while it is operating, but then switches it back on exit (including abrupt termination, but not including panics/SIGKILL). |
Thanks for your response. There are no no warnings issued to the console. My
|
FYI I am on macOS. The behaviour is the same in iTerm and Terminal, and I tried zsh and bash. |
Are those command lines verbatim (modulo What happens if you try Does anything change if you use |
Now I understand:
|
I'm glad you found it. Is there anything I can help with? My experience with Rust is about zero but I'm up for trying things if that helps you. |
Is there something to be done? This issue is probably a design limitation and can't be just fixed. Does the |
Sorry, I don't have the skills yet to give this a try. Thanks for your help, and your useful piece of software! |
I use websocat through a series of test scripts on macOS and appending |
What console IO method should be default on Mac? Async or threaded? Or shall there be some tricky auto-detection? |
The same problem for me. Text frames are truncated until the next frame being received. mac os |
@yeryomenkom Does the |
I've hit this issue as well, on Linux. I ran into it when piping the output of It's not OK to make the terminal non-blocking for other applications in a pipeline. I realize that it's unusual that changing stdin also changes stdout, but nonetheless, this is a common issue, and makes shell pipelines unreliable. And a tool like (For that matter, even if stdin and stdout were independent, changing stdout would break things like Conversely, relying on the blocking or non-blocking status of stdin/stdout means that websocat itself would break if something else in the pipeline changed stdin or stdout to blocking mode. Please consider making the threaded implementation the default everywhere (including for the one-argument form of websocat, and for |
OK, maybe it can be Shall I publish websocat 1.7.0 with just this change alone? |
Published v1.7.0 where the workaround is now the default behaviour. |
Thanks!! |
Hi, I have a websockets endpoint that outputs messages of around 1500 bytes. When I run
websocat ws://my-endpoint
the output to my terminal is truncated to 1024 bytes. Then the next message is received, the remaining ~300 bytes of the first message, and the full next message are displayed. Then for the third message, the process repeats, with a truncation to 1024 bytes at first.I verified that the websockets data itself is correct via inspection through
tcpdump
.When I pipe the output to a file, the entire message is written to it.
When I pipe the output through
less
, same.When I pipe the output through
cat
I get the message:cat: write error: Resource temporarily unavailable
What's an explanation for this behaviour? Could it be related to nonblocking output, e.g.
UnixFile::raw_new(std::io::stdout()).set_nonblocking(false);
?The text was updated successfully, but these errors were encountered: