vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
7.02k stars 272 forks source link

display timestamps #71

Open stuartcrobinson opened 4 years ago

stuartcrobinson commented 4 years ago

would be great to have an option to display timestamp when messages were sent and received

would also be great to have an option to display RTT for round-trip events like echos

thanks for the great tool

vi commented 4 years ago

Do you mean just log messages (such as with websocat -v -v) with timestamps or timestamps as part of what is being printed to stdout?

stuartcrobinson commented 4 years ago

log messages with timestamps would be great!

and, separately, an option like "show time since last sent client message" or something, per response from server, would be divine :)

(as a way to compare using websocket connections to my server vs just using http)

On Thu, Jan 30, 2020 at 6:02 PM Vitaly Shukela notifications@github.com wrote:

Do you mean just log messages (such as with websocat -v -v) with timestamps or timestamps as part of what is being printed to stdout?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vi/websocat/issues/71?email_source=notifications&email_token=ADCUNTHF4SYTJWY52UGJSS3RANL7TA5CNFSM4KN6MWFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKM4I3A#issuecomment-580502636, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCUNTFVMJVCI76RB3KS7P3RANL7TANCNFSM4KN6MWFA .

vi commented 4 years ago

If you want to auto-disconnect from non-responding server or client, there are --ping-interval and --ping-timeout options.

phraktle commented 3 years ago

it would be great to see RTT for pings, so one can measure websocket latencies.

vi commented 3 years ago

@phraktle , Sending timestamp and logging RTT for --ping-interval is indeed a reasonable and relatively simple feature to add.

phraktle commented 3 years ago

As a workaround, one may use the ts tool from the package moreutils:

websocat -v --ping-interval 1 [url] 2>&1 | ts -i "%.s"
vi commented 3 years ago

Added RTTs to Websocket pong receiving code, also added --print-ping-rtts option for print them to stderr in easy-to-parse format regardless of log level.

display timestamp when messages were sent and received

Note that now there is timestamp: overlay to mangle messages, forcing them to contain text-based timestamp string.