Case/Assumption:
- There is a server that is written by someone else.
- This server has an endpoint
GET /api/watch
. - This endpoint is plain HTTP/1.1
- This endpoint will write events like
to the response stream once they appear (one event per line and then a flush).{type:"foo", message:"bar"}
- Sometimes this server writes events every second to the output, sometimes every 15 minutes.
- Between my client and this server there is a third-party Load Balancer which assumes a connection as staling if there is no action on the connection for more than 60 seconds and drops the connection without closing it.
- The client is written in simple Golang and simply makes a GET request to this endpoint.
- Once the connection is marked by the LB as staled the client (the same happens to
curl
, too) is not notified that the connection was dropped by the LB and is still waiting for stuff to receive in the response of the GET request.
So: What are my possibilities to deal with this situation?
What is not possible:
- Modify the server.
- Use another server.
- Use something else than this endpoint and how it is written.
- Modify the Load Balancer.
- Use another LB.
- Leave the LB out of the connection.