websocat icon indicating copy to clipboard operation
websocat copied to clipboard

maybe add discussions? maybe stats like curl?

Open f1-outsourcing opened this issue 11 months ago • 5 comments

I am quite new to websockets. I was wondering if (or how) I could use websocat to test a file transfers over ws?

The other thing is I did not see anything in ./websocat --help=long about reporting stats, maybe that could be interesting? Curl has this:

-w '%{http_code},%{time_connect},%{time_total},%{speed_upload},%{size_upload}'

f1-outsourcing avatar Jan 30 '25 16:01 f1-outsourcing

about reporting stats, maybe that could be interesting?

There is Prometheus mode (mostly untested and not activated by default) that has some stats.

Easier counter/stats overlay can be added (probably to Websocat4) sometime.

http_code

This is currently available only in -v -v logs, as far as I remember.

-w

Maybe such option will eventually appear in Websocat in a form that resembles Curl.

maybe add discussions?

Do you mean Github discussions? What advantages do they have compared to issues (that are typically used for support and feature proposals in my projects).

vi avatar Jan 30 '25 19:01 vi

What about how to test file transfers?

f1-outsourcing avatar Feb 02 '25 15:02 f1-outsourcing

websocat -v 'ws://localhost:9000'

[INFO websocat::net_peer] Connected to TCP 127.0.0.1:9000 websocat: WebSocketError: WebSocket HTTP error: Invalid HTTP version specified websocat: error running

I don't want to use the handshake, just plain ws. I assumed giving the ws is forcing this, so why do I see http? How can I only test ws?

f1-outsourcing avatar Feb 21 '25 22:02 f1-outsourcing

I don't want to use the handshake, just plain ws.

Use ws-lowlevel-client: overlay instead of ws:// URL. This would just get WebSocket framing without WebSocket handshake.

websocat -t - ws-lowlevel-client:tcp:127.0.0.1:9000

vi avatar Feb 21 '25 23:02 vi

What about how to test file transfers?

websocat -ub readfile:myfile.txt ws://...
websocat -ub ws://...  writefile:downloaded.dat
websocat -ub --async-stdio ws://... > output_file
websocat -Ub --async-stdio ws://... < input_file

and so on

vi avatar Feb 21 '25 23:02 vi