Skip to content

Commit

Permalink
Merge pull request #1 from randysecrist/rks-add-keepalive
Browse files Browse the repository at this point in the history
add a tick/keepalive option
  • Loading branch information
randysecrist committed Feb 23, 2024
2 parents 48de976 + da65d12 commit 6c1757b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/wscat
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ program
'print a notification when a ping or pong is received'
)
.option('-s, --subprotocol <protocol>', 'optional subprotocol', collect, [])
.option('-t, --tick <message>', 'send a message every 5 seconds')
.option('-w, --wait <seconds>', 'wait given seconds after executing command')
.option('-x, --execute <command>', 'execute command after connecting')
.parse(process.argv);
Expand Down Expand Up @@ -261,6 +262,9 @@ if (programOptions.listen) {
if (programOptions.proxy)
options.agent = new HttpsProxyAgent(programOptions.proxy);
if (programOptions.location) options.followRedirects = true;
if (programOptions.tick) setInterval(function() {
ws.send(programOptions.tick);
}, 5000);

options.maxRedirects = programOptions.maxRedirects;
options.headers = headers;
Expand Down

0 comments on commit 6c1757b

Please sign in to comment.