Data streaming interrupted unexpectedly

I’ve implemented simple rest client for Streaming API, which sends temperature measurements every 5 seconds. All works fine, but at some point process just stops and new dots are not appearing. This can happen withing 15 minutes after start or 1 hour. Tcp connection remains open, underlying stream remains writable, but new points just not showing on the graph. I figured out empirically that Content-Length header has impact on that - if it’s large - all works fine for a loner period.