I'm new on Godot engine and I'm working on a simple project where I need to perform some HTTP calls.
I have read the HTTPClient class documentation and I don't understand why the thread is stopped during http polling.
while http.get_status() == HTTPClient.STATUS_REQUESTING:
if not OS.has_feature("web"):
OS.delay_msec(500) # here
while http.get_status() == HTTPClient.STATUS_BODY:
var chunk = http.read_response_body_chunk() # Get a chunk.
if chunk.size() == 0:
OS.delay_usec(1000) # here
rb = rb + chunk
You can find the full example here
These sleep lines slow down the request. I tried to remove these lines and it seems to work. Can I remove them safely or am I missing something ?
I know there is a high level HTTPRequest class but I need more control (I don't want to use the signal design with the HTTPRequest class). Anyway, I would like to understand this polling mechanism.