Open Foster024 opened 4 years ago
Do you mean WebSocket-level pings or some application-level (e.g. IRC over WebSocket) pings?
If it is application-level (i.e. text or binary WebSocket messages with semantic of ping instead of a special WebSocket message type used for pings) then you need to implement such pings yourself by periodically writing something into Websocat for it to keep the connection alive.
I mean the https protocol application level pings on top of WebSocket. Yes, I made a “crutch” which I run in the terminal: ./ping.sh
while [0] do echo -e "{" type ":" PING "} \\ n" | nc 127.0.0.1 1234 sleep 300 done c
Yes, something like this should be used. I don't think handling of application-level pings should be part of Websocat itself.
I want to ask you. Is it possible to transfer the contents of a file from a local drive? This is necessary so as not to manually enter the initial commands from the keyboard each time after establishing a connection to the server. A prerequisite should be the ability to continue the created communication sss wss. I tried to do it like this: cat commands.txt | websocat wss: //site.com/ But after executing the commands from the commands.txt file, the websocat shell closes and I again see the bash terminal.
Maybe you want rlwrap websocat wss://site.com/
?
You can then use line editing and input history.
it is amazing! :) ty!
Hey. A typical request for a ping command looks like this template: Ping Pong But there are servers (like this wss: //pubsub-edge.twitch.tv) that do not understand this syntax. They understand this: {"type": "PING"} {"type": "PONG"}
The "--ping-interval" flag sends ping by the first pattern. Because of this, after about 5 minutes, the connection is disconnected. How to make it send ping on the second pattern?