Open jbkly opened 10 years ago
@jbkly this is not currently implemented, but I've definitely thought about it. It would require some low-level changes to make it synchronous for GetJSON, but I'll see if I can include it / lay the groundwork for it in the work I'm doing for v4.0
I'm pushing this until after the v4.0.0 release. As far as I can tell, this should be feasible in both Windows and Mac, but it'll be a little bit of an undertaking. I'll use this issue for notes and design.
Initially design as a wrapper (like AsyncWrapper
) for use like the following:
' WebParallelWrapper.cls
' @param {Array|Collection|Dictionary} Requests
Public Function ExecuteParallel(Requests As Variant) As Variant
' If Requests is Array return Array of WebResponse
' Collection -> Collection
' Dictionary -> Dictionary
' Dictionary is useful for named requests,
' but Array/Collection is probably most common use case
End Function
' YourModule.bas
Dim Client As New WebClient
' Setup Client...
Dim Wrapper As New WebParallelWrapper
Set Wrapper.Client = Client
Dim Requests() As WebRequest
' Or Requests As New Collection
' Or Requests As New Dictionary
' Setup and add requests...
Responses = Wrapper.ExecuteParallel(Requests)
' -> Responses = Array of WebResponse
Notes:
Hi Tim, is this enhancement implemented? I'm really interested
Thank you
Gerald
See #206 for a better Async capability which allows requests in parallel. So you can already send them in one by one and process the requests via a call-back when they complete.
However this is Windows only - not being a Mac user I haven't been able to look at doing cUrl calls in parallel.
The ability to do multiple requests in parallel from one synchronous call would require a wrapper to make the requests and wait for all of them to complete before returning to the caller.
Is there any support for passing in an array of urls to GetJSON so you can get multiple resources with one get request?