Case/Assumption:
GET /api/watch
.{type:"foo", message:"bar"}
to the response stream once they appear (one event per line and then a flush).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:
15 minutes is an incredibly long quiet period for basic HTTP - possibly better-suited to WebSockets. Short of a protocol change, you should be able to adjust the timeout period on the load balancer (hard to say since you didn't specify what the LB is) to better suit your use case, though not all load balancers will allow timeouts as high as 15 minutes. If you can't change the protocol and can't turn the timeout up high enough, you would have to send keepalive messages from the server every so often (just short of the timeout period, so maybe 55s with your current config, or a little less than the highest timeout period you're able to set on the LB). This would have to be something the client knew to discard, like {"type": "keepalive"}
- something easily identifiable on the client side as a "fake" message for keepalive purposes.