This is what I been using for a while in our application.
Changed connection open? check to :read so server streaming is seen as a valid state for the connection.
And added a keepalive to make sure the connection is still open of the server stream because if a service like nginx breaks the connection you won't get any notification so you will never close the connection even if it's already broken.
Also added some error handling cases so it won't cause any server errors.
This is what I been using for a while in our application.
Changed connection open? check to :read so server streaming is seen as a valid state for the connection.
And added a keepalive to make sure the connection is still open of the server stream because if a service like nginx breaks the connection you won't get any notification so you will never close the connection even if it's already broken.
Also added some error handling cases so it won't cause any server errors.
312