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

Feature-request - support term-color to highlight messages from/to with different color #79

Open vgrebenschikov opened 4 years ago

vgrebenschikov commented 4 years ago

It is a feature request idea is simple - to have some key --color (--no-color) to highlight messages from server with one color and messages to server (e.g. typed in stdin) with other color.

Activated only in case if stdout is isatty.

vi commented 4 years ago

This would probably come together with readline (line editing, etc.) support.

For now, you can use a workaround:

$ rlwrap -w300 --prompt-colour=blue --substitute-prompt='> '  websocat wss://echo.websocket.org/
> afddsafdsaf
afddsafdsaf
> 12313213
12313213
>
vi commented 4 years ago

Another partial workaround allowing to discriminate input and output is prefixing (in the latest version from Git):

$ ~/code/websocat/target/debug/websocat --text-prefix T: --binary-prefix B: wss://echo.websocket.org
sadfasdf
T:sadfasdf
wqewqe
T:wqewqe

Note that it also accepts and cuts away T: prefix from input messages.