How to send heartbeat to prevent stream closing from arduino api?
Under the plot.ly streaming API documentation, I read: "A client stops writing data for a time period longer than a minute. If a minute passes without receiving any data from the client the stream connection will be closed. (A connection can be maintained by writing a heartbeat within the 60 second window, a heartbeat is simply a newline)."
How to do this from the arduino api? It seems that I can only send numbers from the arduino api, not newline characters as above.
Please advise. I've been plotting sensor data that is updated roughly every 10 minutes or so, and it seems that the stream often gets closed or destroyed between postings to plotly. I think the above may be the reason why it is happening.
Currently, the library checks if the connection is open or closed before every write. If the connection was closed (either a network error or a timeout) then we re-open the connection and then make the request.
I kept the heartbeat functionality out of the library in order to reduce the number of persistent connections (otherwise, we'd have thousands of idle connections to plotly!) This will introduce a 10-20 second delay when re-opening the connection (and sometimes opening the connection on the Arduino takes several tries).
Does that make sense? Thanks for reaching out!
In the past I would lose all data sent after a connection was closed (either a network error or a timeout). It sounds like that's no longer the case?