wscat icon indicating copy to clipboard operation
wscat copied to clipboard

Add support for hexadecimal input/output

Open jazzpi opened this issue 10 years ago • 2 comments

This PR adds two options: --hex-in and --hex-out.

If --hex-in is set, input is interpreted as space-separated bytes. E.g., 6a 61 7a 7a 70 69 is interpreted as jazzpi.

If --hex-out is set, anything coming in to the websocket is printed as space-separated bytes. E.g., if wscat is running in --listen-mode and a client sends jazzpi, it's printed out as 6a 61 7a 7a 70 69.

Note: I'm not quite sure about the internals of ws, so I just was cautious and implemented Hex conversion for Buffers, ArrayBuffers and strings (see lines 177-198).

jazzpi avatar May 16 '15 21:05 jazzpi

Looks good. Can you resolve the conflicts and I'll merge it?

nwwells avatar Jan 24 '17 20:01 nwwells

You will try

Rock-vijay avatar Feb 07 '22 16:02 Rock-vijay