chunkysteveo / OctoPrintAPI

Library for use with Arduino compatible micro controllers (web enabled) to access the Octoprint API on Raspberry Pi's running the Octoprint 3D printer web server by the brilliant Gina Häußge, aka @foosel.
GNU General Public License v2.0
42 stars 24 forks source link

Unable to retrieve printer statistics #8

Closed sidddy closed 5 years ago

sidddy commented 6 years ago

After upgrading the ESP8266 core packages to 2.4.2, an API call for the printerStatistics fails. It seems like the change I introduced a few weeks ago (which enforced connection closure by the server when all response data was sent) leads to "early connection closure" now: Although the response was is yet fully read, _client.available() is zero and _client.connected() is false... weird.

I'm wondering if OctoprintAPI should just consume the standard ESP8266HttpClient instead of implementing its own HTTP client... it should avoid weird issues like this one. What's your opinion on this? I'll probably do that change to fix my current project and I'll be happy to share the fix via pull request :-)

chunkysteveo commented 6 years ago

Hi @sidddy - we've gone with it's own HTTP client rather than the ESp8266 HTTP client as the library is cross device complient - working on both the ESP8266, ESP32 and also I have had it working on boards with an Ethernet controller. Would be keen to keep this cross device compatibility and look to resolve the underlying issues with the new core package.

chunkysteveo commented 6 years ago

https://github.com/witnessmenow/arduino-instagram-stats/blob/master/src/InstagramStats.cpp#L122 Brian had a connection issue on 2.3 of the ESP8266 core that caused a false response on connection. Not sure if that link will help you, but maybe worth adding in something similar to line 122, checking for false and then connecting again if false.... oddity, Brian said this was just for 2.3 though?