I need to process a lot of data and I want to make sure that the API will not return a server error or a Exception like WurflCloud_Client_HttpException .
Does the API have a way to change the timeout of the service?
Timeout using Fsock
Re: Timeout using Fsock
Due to a bug in the WURFL Cloud Client code, the default method of adjusting the timeout is not honored, but version 2 of the client is finished, and we're just days away from release. Note, however, that the new client for PHP will require some minor changes since the new library is namespaced.
In the meantime, you can extend the included fsock HTTP class to adjust the timeout:
Then you can tell the client to use this client:
Note that increasing the timeout will not guarantee that no exceptions will be thrown. For example, on my local test machine (Ubuntu Linux), there is a local DNS proxy that occasionally fails, which causes a DNS error, which results in an exception in the client. If you really want to catch all the exceptions, you'll need to wrap your code in a try/catch block:
In the meantime, you can extend the included fsock HTTP class to adjust the timeout:
Code: Select all
class CustomHttpClient extends WurflCloud_HttpClient_Fsock {
// Set time in milliseconds (10000 = 10 seconds)
protected $timeout_ms = 10000;
}
Code: Select all
$config = new WurflCloud_Client_Config();
$config->http_method = 'CustomHttpClient';
$config->api_key = '123456:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client = new WurflCloud_Client_Client($config);
Code: Select all
try {
$client->detectDevice();
} catch (Exception $e) {
// Client threw exception, do something more graceful here
}
Thanks,
Steve Kamerman
ScientiaMobile
Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
Steve Kamerman
ScientiaMobile
Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
Who is online
Users browsing this forum: No registered users and 6 guests