ThingSpeak TCP connection closing
VegasIOT opened this issue · 1 comments
Got this email from ThingSpeak
During a recent planned update to the ThingSpeak server infrastructure, we noticed that one or more of your devices are sending data to ThingSpeak and closing the TCP connection without providing sufficient time for ThingSpeak API servers to respond, or confirming the data made its way to the ThingSpeak servers. This is not a recommended approach and may result in loss of data as the assumption that the data being sent is accepted may not always be valid. For example, if your device tried to update a channel 50 times a second, that is faster than your allowed update rate and the data may have been rejected. If the device did check the response, it would notice that it got a '0' response back indicating that the channel was not updated. In the case of closing the connection before ThingSpeak sent a response code back, a HTTP 499 status code would be sent back, but, because the device wasn't leaving the connection open, this was not known to the device.
Analysis of code patterns leads us to believe that the custom code that did this does not use the ThingSpeak library. It is strongly recommended that you use the ThingSpeak library from https://github.com/mathworks/thingspeak-arduino for updating ThingSpeak channels from devices like Arduino, ESP8266, Particle Photon, Particle Electron, etc. The library provides a higher level API and manages the connections for you. The library also contains new examples for newer devices that you may be using or considering.
If you do not wish to use the library, at the very least, you will need to delay for ~200 milliseconds after making the request to ThingSpeak API server, to ensure that the data made its way to our servers. You can also take a look at some of the examples published here as a starting point on how to update your device code.
Based on feedback from users, we temporarily rolled back our changes to the server infrastructure in order to give users time to update the code on their devices. However, we will be re-introducing the change on Feb 1st, 2019.
If you do not make changes to the code on your embedded device before Feb 1st 2019, requests from those devices may no longer make it to the ThingSpeak API servers and your data will no longer be collected on ThingSpeak.
Please refer to, or respond to, this forum post if you need more information.
I cannot do remote consulting :-(