URLConnection or HTTPSocket for multiple api calls

Greetings,

I do need to use API calls to be able to get some CouchDB files and apparently I have to do a lot of processing, doing that directly in the URLConnection ContentReceived EventHandler will end up blocking the UI and maybe making the app unresponsive so I needed a solution that would maybe run in some threads and do all the process .

The process is the following .

  1. Access the API and fetch all the id’s for a filter , around 13 k of them .
  2. access API and process each id from point 1 and get basic details from each file assigned to that id
  3. access each file based on the point 2 and process it could be between 20 k and 80 k calls
    4 in each file at point 3 access it’s attachments and process them individually , here last status I got , around 600k files to process .

Any idea how this process could be done the best way and to keep the UI still responsive while processing the data and get recurrent calls on the points above ?

So In this case could be appropriate to add a control on the interface and handle some of the data processing in the ContentReceived event or have it as a dynamic property and use handle and weakaddressof and handle all in a thread ? if second part, what would be the best way to handle this ? any example would be appreciated .

Thanks.

You don’t want to do so many requests one after each other. I made a queue where I can process up to 10 requests at the same time. I don’t remember if I used urlconnection or httpsocket. Got random crashes on macOS. After switching to curl from MBS those crashes were gone. If you do your processing in a thread the UI shouldn’t be blocked.