Plot.ly data streaming fails after random period of time
<p>I've implemented simple rest client for Plot.ly 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.</p>

<p>My client is written in C#. Basically i'm writing to opened NetworkStream raw Http request:</p>

<pre><code>private static string GetStringRequest(string host, string token, string data)
{
        var sb = new StringBuilder()
            .AppendLine($"POST http://{host}/ HTTP/1.1")
            .AppendLine($"Host: {host}")
            .AppendLine("Connection: keep-alive")
            .AppendLine("Content-Type: application/json")
            .AppendLine("Content-Length: " + Int64.MaxValue)
            .AppendLine("Cache-Control: no-cache")
            .AppendLine($"plotly-streamtoken: {token}")
            .AppendLine("")
            .AppendLine("")
            .Append(data);

        return sb.ToString();
}

// this is called every 5 seconds
public void WriteMeasurement(float value, DateTime dateTimeUtc)
{
        var data = GetData(...);
        var request = GetStringRequest(Host, _token, data);

        _writer.Write(request); // network stream writer
}
</code></pre>