Skip to content

Commit

Permalink
[minor] Print close reason (websockets#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
towc authored and lpinca committed Nov 16, 2019
1 parent 2edfc48 commit e20483e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/wscat
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function collect(val, memo) {

function noop() {}


/**
* The actual application
*/
Expand Down Expand Up @@ -195,10 +196,10 @@ if (program.listen) {
Console.Colors.Green
);

ws.on('close', (code) => {
ws.on('close', (code, reason) => {
wsConsole.print(
Console.Types.Control,
`Disconnected (code: ${code})`,
`Disconnected (code: ${code}, reason: "${reason}")`,
Console.Colors.Green
);
wsConsole.clear();
Expand Down Expand Up @@ -314,11 +315,11 @@ if (program.listen) {
}
});

ws.on('close', (code) => {
ws.on('close', (code, reason) => {
if (!program.execute) {
wsConsole.print(
Console.Types.Control,
`Disconnected (code: ${code})`,
`Disconnected (code: ${code}, reason: "${reason}")`,
Console.Colors.Green
);
}
Expand Down

0 comments on commit e20483e

Please sign in to comment.