Open danielmofer opened 4 years ago
Did you manage to figure out a solution or workaround? This was helpful for me: https://github.com/websockets/wscat/issues/43
I've seen this happen with other programs, such as when trying to pipe cat
and grep
in a shell script, and the cause is typically that the program is expecting an attached TTY and an stdin channel, when actually these are not available, causing an immediately closed pipe, and both sides to close abruptly.
It's trivial to reproduce this issue with Docker, because the docker run
command can be given -t
(attach TTY), -i
(stdin), or none of them. With none of them, wscat
prints the "error: WebSocket was closed before the connection was established" message and it doesn't work.
Related:
[wscat] isn't written to follow conventions that make it suitable for scripted use (such as keeping prompts on stderr rather than stdout; or suppressing prompts when output is not to a TTY; or treating an EOF as a signal to close a connection). Consider websocat instead.
This tool simply seems exclusively designed with interactive use in mind. Which is not bad at all, especially given the money users paid for it :-) But given that a common usage pattern for CLI tools is to end up scripting them, I guess the minimum that could be done is warning in the README about not to do so with this one...
I am cretaing a function to send the wscat to background and redirecting a FIFO file (mkfifo ppp) to drop the data to send by the streaming.
After execute it, I get the next error:
error: WebSocket was closed before the connection was established
What can I do to drop data to sedn by the wss ?
Thanks.