Hi Duke Nukem,
give me more information about response from ThingSpeak.
Paolo.
Hi Duke Nukem,
give me more information about response from ThingSpeak.
Paolo.
Iāll add some code to capture the responses in question, so we can see what is being sent back from ThingSpeak. Iāll try to get that running Thursday night. Hopefully this helps makes your great libraries even better.
Thanks again
Ok ! Thanks !!
Paolo.
I have a board that reports to Thingspeak over an Electric Imp which is amazingly stable. But I see clearly on the graphs that there is hiccups once in a while where a data point is missing. There was a Thingspeak member of the community a short while ago, maybe he can assist?
On the other hand, can you catch the malformed HTTP reply or is it behind the scene?
Canāt buy an error today.1261 iterations, 0 resets on the Hydra.
Caught 2 http responses from Sparkfun that gacked the app.
Examples of more points of failure. You device might work perfectly, but the server maybe not so perfect so you have to apply suitable protection on yourself for when they blow up.
What is between the two ā-----ā is what ThingSpeak sent, in this case nothing.
Second case they fired back an error message
Some more empty responses and this one
Good to see ThingSpeak is being pushed even if it does cause it to occasionally puke on me.
Hi Duke !
I have to simulate these responses from a server and verify HTTP parser behavior.
It is needed to handle error status code 5xx from the server.
Give me some daysā¦as soon as possibile I will reply with updated ThingSpeak library.
Paolo
@ ppatierno thanks!!
Hi @ Duke Nukem,
as I said in the email I sent you, I will improve the ThingSpeak client using my HttpClient I added to uPLibrary.
For now, the problem is inside Update() method at this line :
dataEntry.Id = Convert.ToInt32(httpResponse.Body);
When there is an internal server error, ThingSpeak replies with an HTML page so the conversion to Int32 fails !
Obviously it isnāt good think for ThingSpeak reply with an HTML page in a RESTful architecture !
To avoid this crash, now I check in HttpResponse that status code is 200 and then execute conversion but I changed Update() method signature so that it returns a bool (true all OK, false error from server).
I donāt upload this modification on CodePlex for now.
Can you test it for me ?
How can I send you update client ?
Paolo.
I applied the same modification in ReadChannel() method that return null if an error occurred.
Paolo.
Iāll have the guys at ThingSpeak receive 10 lashes each before the mast and suggest they fix their stuff as well.
I still have all my test boards, so Iām good to go for testing your updated library and sent you a direct message with my email address where you can send those libraries.
Thanks
[quote=āppatiernoā]
Obviously it isnāt good think for ThingSpeak reply with an HTML page in a RESTful architecture ![/quote]
The HTML result for an erroneous HTTP request is more like a comment than part of the machine-to-machine interaction.
This is similar to the āOKā in an HTTP response line (āReason-Phraseā), which should be regarded as a human-readable comment, never to be interpreted in a critical way:
āThe Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user.ā (HTTP 1.1 specification)
The Reason-Phrase can be localized, or can even be empty. A client should not depend on it.
In a similar way, a client should not depend on the response message body of requests that return other status codes than 2xx. It should just rely on the status code. Nevertheless, the response may well contain more detailed explanations of the error, whether āmachine-readableā or not. As long as the client does not depend on a specific format, and no security-relevant information is disclosed, this does not hurt.
So the HTML page in an error response is not necessarily a bad thing, nor a violation of REST architecture. I wouldnāt just yet keelhaul the ThingSpeak people for that
Cuno
Thinking about the client could be also a web browser and not only an embedded system where human informartion arenāt neededā¦you are right Cuno
@ cuno maybe just five lashes each?
Latest test results:
There seems to be something magically about 2570.
Errors are where ThingSpeak returned an error
Reset is where an exception was raise
Cerberus
stopped at 2570 Iterations
no errors or exceptions
Spider Wifi
stopped at 2570 Iterations
no errors or exceptions
Spider wired
stopped at 1519 iterations
1 Error
Mountaineer
over 5000 iterations and still running
28 errors
1 exception
Can you keep it running for a while?
Though I wonder whether the same results would occur e.g. for Xively or other services.
Cuno
ThingSpeak has been getting spanked lately so Iām thinking about doing the same test against OpenSen.se to see how it does.
Iām really interested in this repeating 2570 number and tonight Iāll rerun the test and add a Hydra board to the mixed so there be 5 mainboards going and see if this number appears again, then Iāll switch over to OpenSen.se and recreate the test using that.
I have a Cerberus that is testing a similar connection to OpenSen.se now, so once this next round is over, Iāll switch over to sending data to OpenSen.se and see how that goes.
Latest round of testing
Cerberus
stopped at 1496 Iterations
no exceptions
51 caught errors
Hydra
stopped at 1885 Iterations
5 exceptions
example
Last error: Exception was thrown:
System.ArgumentOutOfRangeException
72 caught errors
Spider Wired
stopped at 2570 Iterations - there is that magical 2570 number again
no exceptions
94 caught errors
Spider Wifi
stopped at 1884 iterations
no exceptions
50 caught errors
Mountaineer
over 2800 iterations and still running
90 caught errors
1 exception
Cerberus on OpenSen.se
stopped at 2570 iterations - there is that magical 2570 number again
no errors or exceptions
OK this 2570 number has me wondering what the heck is going on, but it also might be a clue as it might indicate some fixed period of time (ie 2570 * 30 seconds). So Iāll run another test on OpenSen.se but change the timer interval to something else and see if it ends at 2570 or some other number.