Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Queueing HTTP Requests Script

Author
Message
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 13th Aug 2018 08:19 Edited at: 13th Aug 2018 14:32
I thought I'd share a bit of code I've written for my next version of my app. It queues http requests one after the other and cycles through the list until all requests have been made. Each time a request is made and the data received it's moved from the list and the others are moved down. If one fails to get a valid response, and instead gets a -1 it's moved to the end of the queue to try again shortly.

It's also been set up so that the list doesn't have the same call to the server more than once. In the do loop I've added a small delay between each send so that he server isn't being called too often and too quickly.

It allows up to a 100 calls, but you can change that number.

This is for server calls where you want to receive data but you don't want the user waiting. It can all happen in the background. There will obviously be calls where you have to wait for the data before you can proceed. You can do that with the below code by putting the RunThroughServerCallQueue() in a loop like 'repeat until' i.e. repeat until that specific call isn't in the list.



EDIT: Just updated code as I forgot to add httpResponse$ as a global variable.

Login to post a reply

Server time is: 2024-11-23 17:48:12
Your offset time is: 2024-11-23 17:48:12