Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep-Open Option #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Keep-Open Option #41

wants to merge 2 commits into from

Conversation

Frugality
Copy link

Hi -

I have a use case for wscat, where I need to send a message to a remote server, and then leave the connection open, so I can receive the responses. As such, I added a simple "keep-open" flag, which doesn't close the web socket or exit the process after the console is closed. This allows wscat to be used in conjunction with echo/cat/etc and an input pipe:

echo '{"type":"message-type"}' | wscat --keep-open -connect localhost:80

Creating a pull request in case this might be useful to others.

Cheers,
-Courtland

Frugality added 2 commits May 22, 2017 12:42
  added --keep-open, to keep the socket open even after end-of-file is reached (useful in conjuction with cat/echo)
@lpinca
Copy link
Member

lpinca commented May 23, 2017

It makes sense, should the same be done for the server (--listen)?

@lpinca lpinca mentioned this pull request Dec 4, 2017
@nwwells
Copy link
Collaborator

nwwells commented Dec 6, 2017

I just tested this out and can't seem to make it work.

@nwwells
Copy link
Collaborator

nwwells commented Dec 6, 2017

To be clear, the keep-open works, but not the piping stdin

@lpinca
Copy link
Member

lpinca commented Dec 6, 2017

I guess this doesn't work because 'line' events are ignored before the WebSocket is open. To make it work with the current implementation we should probably buffer them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants