pb-httprequest-manager

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
deseven
Enthusiast
Enthusiast
Posts: 367
Joined: Wed Jan 12, 2011 3:48 pm
Location: Serbia
Contact:

pb-httprequest-manager

Post by deseven »

A queue manager for HTTPRequest(), supports timeouts, parallel requests and completion events. Originally created to mitigate a couple of bugs, but can also be used if you need to make a ton of requests with little effort.

Basic usage example:

Code: Select all

IncludeFile "httprequest-manager.pbi"

InitNetwork()
HTTPRequestManager::init()

For i = 1 To 10
  HTTPRequestManager::easyRequest(#PB_HTTP_Get,"https://google.com/")
Next

While HTTPRequestManager::getNumActive()
  HTTPRequestManager::process()
  Delay(50)
Wend

HTTPRequestManager::free(#PB_All)
The most recent version and more complex example can be found on github: https://github.com/deseven/pb-httprequest-manager
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: pb-httprequest-manager

Post by Kwai chang caine »

Works here, thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
deseven
Enthusiast
Enthusiast
Posts: 367
Joined: Wed Jan 12, 2011 3:48 pm
Location: Serbia
Contact:

Re: pb-httprequest-manager

Post by deseven »

Updated with the ability to handle binary data (for downloading files) and a couple of other small improvements.
There is no proper changelog, but you can check out the changes in the commit.

One important thing I should definitely mention:
- response\response is now split into two separate fields - text and binary. As a direct replacement you should use text.
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: pb-httprequest-manager

Post by Caronte3D »

Nice!
Thanks for sharing it :wink:
Post Reply