I configured HAProxy with “timeout tunnel 40s”. I then connected a WebSocket through HAProxy where the client application transmits a lot of data, but the server only sends something back every 5 minutes. The client transmits furiously for about 55 seconds and then HAProxy cuts the connection. This behaviour is consistent.
From the documentation, it says the HAProxy will only cut the connection if the timeout elapses with no traffic in either direction. There was plenty of traffic in this case, but only from client to server.
I modified the configuration of HAProxy to “timeout tunnel 3600s” and the disconnection went away.
If it helps, the client connects via a WebSocket over SSL to HAProxy, and HAProxy connects to the backend server unencrypted. The backend server is on the same machine as HAProxy.