wscat icon indicating copy to clipboard operation
wscat copied to clipboard

Merge in "verbose" mode

Open nwwells opened this issue 8 years ago • 7 comments

@truhlikfredy, what do you think about adding a command-line flag for verbosity?

nwwells avatar Jan 24 '17 21:01 nwwells

Yes that would be better, because now does only hardcoded console.log()

truhlikfredy avatar Jan 25 '17 07:01 truhlikfredy

This PR also contains renaming of package, bin and what not. Ideally verbose mode should be locked behind a -v CLI option.

3rd-Eden avatar Jan 25 '17 16:01 3rd-Eden

Right, @3rd-Eden. I was just about to ask, @truhlikfredy, would you be willing to add the flag and remove all the other changes?

nwwells avatar Jan 25 '17 18:01 nwwells

I didn't initiated the PR (i think my fork is not good enough in this stage for merge). The changes made there are very crude and dirty. Renamed the package so it will not overwrite the original when original behavior is needed.

truhlikfredy avatar Jan 25 '17 20:01 truhlikfredy

I'm -1 on these changes. I think there is no real value in printing the flag objects. I would like to see them removed from ws completely but that's another issue.

lpinca avatar Jan 26 '17 06:01 lpinca

This brings up an interesting question, though: What is the expected behavior for binary data? netcat of course just passes it through, but the ws protocol provides the concept of frames, which are converted into \ns by wscat. You could base64 encode binary data (or hex encode, as with #5), what do you guys think of that, @lpinca & @3rd-Eden?

nwwells avatar Jan 26 '17 11:01 nwwells

I think that if the 'message' listener receives a buffer it makes sense to print it as hex.

wsConsole.print(`< ${buf.toString('hex')}`);

Something like this, beautified if necessary. It probably wasn't designed to deal with binary messages. What other tools do in this case?

lpinca avatar Jan 26 '17 11:01 lpinca