From f00c32ae33dda3e8696f682b2041923c4c63af39 Mon Sep 17 00:00:00 2001 From: Courtland Idstrom Date: Mon, 22 May 2017 12:42:11 -0700 Subject: [PATCH] wscat: added --keep-open, to keep the socket open even after end-of-file is reached (useful in conjuction with cat/echo) --- bin/wscat | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/wscat b/bin/wscat index 84737ed..8e3fcb7 100755 --- a/bin/wscat +++ b/bin/wscat @@ -133,6 +133,7 @@ program .option('--cert ', 'Specify a Client SSL Certificate (--connect only)') .option('--key ', 'Specify a Client SSL Certificate\'s key (--connect only)') .option('--passphrase [passphrase]', 'Specify a Client SSL Certificate Key\'s passphrase (--connect only). If you don\'t provide a value, it will be prompted for.') + .option('-k, --keep-open', 'Keep the socket open, even after receiving EOF. Useful in conjunction with echo') .parse(process.argv); if (program.listen && program.connect) { @@ -230,8 +231,10 @@ if (program.listen && program.connect) { }); wsConsole.on('close', function close() { - ws.close(); - process.exit(); + if(!program['keepOpen']) { + ws.close(); + process.exit(); + } }); }; if (program.passphrase === true) {