-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
800 bps when serving webpage with WSGIServer #174
Comments
My intention in the near future is to remove |
Your fix sounds perfectly reasonable for now, and we can get it in for posterity. |
by sending entire webserver response to esp32 in one go if possible
Close #174 by sending entire webserver response to ESP32 in one go if possible
Hi! I've been messing around with a Metro M4 Airlift Lite and hit an interesting snag when trying to serve a webpage using Adafruit's
esp32spi_wsgiserver
andadafruit_wsgi.wsgi_app
. (Code is here for those interested.) When serving the webpage, I was getting only about 800 bits per second, slow enough to cause Chrome to have issues recognizing the format of the page as HTML because (I assume) the<!DOCTYPE html>
did not arrive quickly enough. After digging throughdebug=True
logs and the various modules ofadafruit_esp32spi
, it seems like the issue is thatWSGIServer.finish_response
is sending data toESP_SPIcontrol.socket_write
one byte at a time. This bypassessocket_write
's built-in chunking and seems to cause a lot of extra overhead, possibly due to #108. To fix this I use a slightly modified version ofesp32spi_wsgiserver
where Isocket_write
the entire response at once if possible instead of looping over every char in the response and writing it individually. This increased data rate to something like 178 kbps. Anyways, my questions are:The text was updated successfully, but these errors were encountered: