Closed yeryomenkom closed 5 years ago
Maybe you want binary mode -b
?
Other influential options: --no-line
, --no-fixups
, --linemode-strip-newlines
, --strict
.
Depending of what you need (client mode, server mode, broadcast or just one client, uni- or bi-directional) I may recommend some specific command line to use.
Why
By default Websocat operates in text mode and tries to ensure that one line corresponds to one text message (both for sending and receiving).
Maybe you want binary mode -b?
No, I need to send text websocket frame. UPDATED: Here is a reference: https://tools.ietf.org/html/rfc6455 , "5.6. Data Frames"
I may recommend some specific command line to use.
Thanks) I have a server that accepts websocket connections and somehow responds to the commands. The server is tested via integration test and works as expected. But, when I try to connect to that server via 'websocat', the issue with '\n' symbol occurs.
So, --linemode-strip-newlines
does the job.
Thank you for your help!
Weird, but I do not see that flag in -help
. Do I miss something?
--help=full
?
Do you think this is important enough option to be moved to short help?
Do you think this is important enough option to be moved to short help?
I think yes. Honestly speaking, I would even change the default behavior for sending text frames. Websocket protocol specifies nothing regarding the new line symbol in the end of text frame. So, at least for me, it was very confusing to realize that 'websocat' adds that symbol by default.
adds that symbol by default
More like "not removes the extraneous symbol by default". Newline is typically present in user input. It gets inserted when one presses Enter.
You can send one message without \n
and without --linemode-strip-newlines
as well:
$ printf 'qwerty' | websocat ws://...
[WARN websocat::line_peer] Sending possibly incomplete line.
More like "not removes the extraneous symbol by default". Newline is typically present in user input. It gets inserted when one presses Enter.
I see. But in what case user may want to insert that symbol? I think user presses enter to send text frame. When I type mkdir lol
and press Enter I expect that "lol" directory will be created. Not 'lol\n'.
You can send one message without \n and without --linemode-strip-newlines as well:
Maybe I can, but I will never do)
@maxstreese