We've seen cases where a misbehaving NAT will terminate the long-running websocket connection when it's idle and not send a FIN packet to the agent code. When this happens, the agent does not know that the connection is terminated, and the agent will not trigger its automatic reconnect logic.
One way to handle this is to have the agent periodically send a packet (e.g., the sessions command) every minute or less to make it appear to the NAT that the connection is still in use. This is what the agent already does for the UDP connections that actually carry the browser session data.
The current implementation of the agent code only sends a single sessions command on the long-running websocket connection and then it closes the input stream since it doesn't need to send any additional information. (All information after the initial connection from the agent comes from the Reflect API.) So, making this change will require modifying the STDIN pipe to the websocat process and potentially changing how the input is generated.
We've seen cases where a misbehaving NAT will terminate the long-running websocket connection when it's idle and not send a FIN packet to the agent code. When this happens, the agent does not know that the connection is terminated, and the agent will not trigger its automatic reconnect logic.
One way to handle this is to have the agent periodically send a packet (e.g., the
sessions
command) every minute or less to make it appear to the NAT that the connection is still in use. This is what the agent already does for the UDP connections that actually carry the browser session data.The current implementation of the agent code only sends a single
sessions
command on the long-running websocket connection and then it closes the input stream since it doesn't need to send any additional information. (All information after the initial connection from the agent comes from the Reflect API.) So, making this change will require modifying the STDIN pipe to thewebsocat
process and potentially changing how the input is generated.