Api clients / JavaScript / V3 / Methods

Configuring Timeouts | JavaScript API Client V3 (Deprecated)

This version of the JavaScript API client has been deprecated in favor of the latest version of the JavaScript API client.

Required API Key: no ACL required
Method signature
client.setTimeouts({
  connect: integer connectTimeout,
  read: integer readTimeout,
  write: integer writeTimeout
})

About this method

Override the pre-configured timeouts.

Network & DNS resolution can be slow. That is why we have pre-configured timeouts. We do not advise to change them, but it could make sense to change them in some special cases.

Note: Not all parameters are available for every language. See Parameters below.

Examples

1
2
3
4
5
6
$config = SearchConfig::create('YourApplicationID', 'YourAdminAPIKey');
$config->setConnectTimeout(2);
$config->setReadTimeout(30);
$config->setWriteTimeout(30);

SearchClient::createWithConfig($config);

Parameters

connectTimeout
type: integer
default:
Optional

Timeout for the tcp session to connect.

Available in all languages except Swift, C#, and Kotlin.

readTimeout
type: integer
default:
Optional

Timeout for the read on the tcp socket.

Available in all languages.

writeTimeout
type: integer
default:
Optional

Same as requestTimeout but applies only to write operations.

Only available for the following languages: javascript, kotlin, csharp.

hostDownDelay
type: integer
default:
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 Android, C#, Java, Go, and Scala.

dnsTimeout
type: integer
default:
Optional

Timeout for the dns resolution.

Only available for Scala. This timeout exists as connectTimeout in the other clients. If both conectTimeout and dnsTimeout are set in Scala client, the shorter of the two is used.

searchBatchTimeout
type: integer
default:
Optional

Same as requestTimeout but applies only to batch operations.

Only available for Ruby.

searchReadTimeout
type: integer
default:
Optional

Same as requestTimeout but applies only to search operations.

Only available for Ruby and Swift.

requestTimeout
type: integer
default:
Optional

HTTP timeout for the request.

Only available for Scala.

Response

No response.

Did you find this page helpful?