This object should not be confused with the request table passed into the HTTP request handler callback that is registered using http.onrequest(). An httprequest object embodies a transaction that will be sent by the agent; the HTTP request handler callback’s request parameter is a table of decoded data from a transaction that has been received.
The number of requests you can make is rate-limited. Available request credits are shared among httprequest and httpstream. You have credit for a total of 40 requests of any type, ie. if you issue 20 httpstreams you can only issue 20 httprequests until your credits are replenished. As requests are issued they regenerate at the rate of two credits per second, up to the maximum of 40. This allows you to make 120 requests in 60 seconds, issuing up to 40 at any one time.
For sample code that can be used to manage messaging between agents and the Internet, see the imp API Cookbook recipes ‘Basic Agent-to-Internet Communications’ and ‘Long-polling Agent-to-Internet Communications’.
The httprequest object has the following member methods: