Configuring timeouts
$config = SearchConfig::create('YourApplicationID', 'YourAPIKey'); $config->setConnectTimeout(integer connectTimeout); $config->setReadTimeout(integer readTimeout); $config->setWriteTimeout(integer writeTimeout); SearchClient::createWithConfig($config);
We released a new version of the PHP API client in public beta. Read the beta documentation for more information.
We released a new version of the JavaScript API client in public beta. Read the beta documentation for more information.
We released a new version of the Java API client in public beta. Read the beta documentation for more information.
You’re currently reading the JavaScript API client v4 documentation. Check the migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.
You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.
About this method
Change the pre-configured timeouts.
Because network connections can be unstable and slow, the Algolia API clients have pre-configured timeouts.
Not all parameters are available for every language. See Parameters below.
Examples
Read the Algolia CLI documentation for more information.
1
2
3
4
5
6
$config = SearchConfig::create('YourApplicationID', 'YourWriteAPIKey');
$config->setConnectTimeout(2); // connection timeout in seconds
$config->setReadTimeout(30); // read timeout in seconds
$config->setWriteTimeout(30); // write timeout in seconds
SearchClient::createWithConfig($config);
Parameters
Parameter | Description |
---|---|
connectTimeout
|
type: integer
default: different for every client
Optional
Timeout for the TCP session to connect. Available in all clients except Swift, C#, Go, and Kotlin. Default values:
|
readTimeout
|
type: integer
default: different for every client
Optional
Timeout for the read on the TCP socket. Default values:
|
writeTimeout
|
type: integer
default: 30 s
Optional
Same as requestTimeout, but applies only to write operations. Available in all clients except Scala. Default values:
|
hostDownDelay
|
type: integer
default: different for every client
Optional
The expected period of time for a down host to get back up again. Impacts the time between API Client retries. Only available for C#, Java, Go, and Scala. Default values:
|
dnsTimeout
|
type: integer
default: 200 ms
Optional
Timeout for the DNS resolution. Only available for Scala. This timeout exists as Default values:
|
searchReadTimeout
|
type: integer
default: 5 s
Optional
Same as requestTimeout, but applies only to search operations. Only available for Swift. Default values:
|
requestTimeout
|
type: integer
default: no default
Optional
HTTP timeout for the request. Only available for Scala. Default values: This timeout allows you to configure a global timeout that supersedes all other timeouts. Since it affects all different timeouts, there is no default value. |
Response
This method doesn't return a response.