The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Is there a way to delay HTTPRequests?

I'm making a drawing app in Godot, it's linked to an API that saves drawings to a server. Everything is fine only the first time you press save on the drawing a 0KB file gets uploaded. Second time the button is pressed the drawing gets fully uploaded. What's more baffling is when a new drawing is made (either by clearing or drawing over the previous one), rather then save the new drawing, the previous drawing is saved on the first button press, and new drawing saved on second same button press.

The image is processed into base64 then sent to server where it's decoded and saved. I know it's not an API problem because when trying to send a local PNG file just wired to the button it works flawlessly. It's only when taking viewport data > processing > sending that this happens.

My theory is the time difference between Godot's processing the image and sending the data is too little. So back to my question, is there a way to delay HTTPRequests?

EDIT. As a test I made a second button, one to process the image, one to send the data. It works perfectly. What is happening?

in Engine by (39 points)

1 Answer

+1 vote
Best answer

Found a way, nothing direct with HTTPRequest but using Timer node with it works. Followed things here: https://godotengine.org/qa/9758/timer-node-how-to-use-it-in-code

by (39 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.