Replies: 2 comments
-
These are excellent questions, and unfortunately I don't have answers for them. The webserver does run in its own thread, as do the callbacks. If you need to do processing outside of callbacks, then you definitely need some threadsafe stuff. I explained how I'm doing that in my other project yarrboard or you can dig in to the code to see how its working.
I can't remember what happens if you delay or yield too long inside a callback, but I think it just blocks processing. The server is async in its own thread, but it can only process one request at a time (at least until we get the async workers stuff fully tested) Those last 2 questions are very interesting. There are definitely timeouts on the TCP connections, but I don't know what they are set to. There are quite a few configuration options in the esp-idf http server library that does the gruntwork, which is exposed as the server.config object.
I'm moving this to discussions. If there are specific things you want to address, or have a PR for better documentation please feel free to resubmit. |
Beta Was this translation helpful? Give feedback.
-
(Thanks for the thoughtful response! And I didn't notice that discussions were on, this is definitely a discussion more than an issue. Will reply on other aspects when I have more cycles.) |
Beta Was this translation helpful? Give feedback.
-
I think everyone here knows that ESPAsyncWebServer (or at least its origin fork) is a disaster in terms of thread safety. PsychicHttp is reported to be much better, which is great! But it's important for users to understand threading semantics to be able to write safe code using it...
The README has similar notes as ESPAsyncWebServer does, without clarifying too much: "PsychicHttp is a fully asynchronous server and as such does not run on the loop thread. You should not use yield or delay or any function that uses them inside the callbacks."
It would be good (necessary, even) to know the following
loop()
does, it MUST USE SYNCHRONIZATION, which basically nobody is doing?PsychicHttpServer
object should ONLY be accessed from thesetup()
/loop()
thread??PsychicRequest
object should ONLY be accessed from the request handler??PsychicWebSocketClient
, ONLY access it from the event handler??getClient()
later??getClient()
from??PsychicWebSocketClient
you get back from that??Beta Was this translation helpful? Give feedback.
All reactions