HTTPClient delay, Intentional halt

Two questions:

a) When using HTTPCllient, I am having to place an 8 second delay in the ‘Setup’ section, or I get errors later. Is this normal to have to place such along intentional wait for HTTPClient to finish its own setup process?

b) What is the recommended ‘best practice’ for a forced HALT? If there is an error contacting a website, I just want to generate an error message and HALT the system, rather than going on with missing data. I could use an infinite loop but that will drain the battery, or I could put the device to sleep but that would mean that I lose all contact with it. Any suggestions?

1 Like

Interesting, I didn’t aware of this trick, where did you learn this?

I am having tremendous troubles with this HttpClient library with the Photon 0.44/0.45 firmware. It just randomly crash with a flashing Red then the Photon reset itself. I was able to pin point it to the HttpClient but couldn’t/wouldn’t dive deeper.

//Ed

The most likely reason is the website you’re trying to download is bigger then the 1024 character buffer in the default HTTPClient.

Take a look at ParticleHTTPClient which can handle larger websites. Due to the lack of memory on the Photon (it’s not a PC after-all) downloading websites larger than 17,000 character wont work. So don’t try downloading Google’s homepage which is HUGE!