Closed AlwaysNoobCoder closed 2 months ago
@vi maybe this is silly, but can you give some inputs ?
Typically when recv(3)
or read(3)
syscall returns 0 bytes or maybe after receiving WebSocket close message.
By default (without -E
) it waits for the other direction to also return 0 bytes before considering the connection as finished. With -E
it drops possible future or pending data and closes the other direction immediately.
For example, in this invocation:
websocat wss://ws.vi-server.org/mirror
there are two directions:
If you press Ctrl+D, you cause stdin to signal end-of-file, so it finishes the first direction. If WebSocket sends close message or drops the connection, it finishes the second direction.
@vi thanks!
without -E
, websocat command will not exit, even the server already closed the websocket session, this behaviour is a bit confusing for me.
how do websocat know the other one reached EOF ?