Skip to content

Commit f0fac71

Browse files
authored
docs: requestHandler configuration short form example (#5822)
* docs: requestHandler configuration short form example * docs: update CLIENTS.md * docs: reorder sections
1 parent 18d2e6d commit f0fac71

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

supplemental-docs/CLIENTS.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,47 @@ new S3Client({
323323
});
324324
```
325325

326+
#### New in [v3.521.0](https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.521.0)
327+
328+
As of version [v3.521.0](https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.521.0) of our clients, you can use a shortened syntax
329+
to configure the requestHandler.
330+
331+
The following are equivalent in Node.js:
332+
333+
```ts
334+
// Example: long form requestHandler configuration.
335+
import https from "node:https";
336+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
337+
import { NodeHttpHandler } from "@smithy/node-http-handler";
338+
339+
const client = new DynamoDBClient({
340+
requestHandler: new NodeHttpHandler({
341+
requestTimeout: 3_000,
342+
httpsAgent: new https.Agent({
343+
maxSockets: 25
344+
}),
345+
}),
346+
});
347+
```
348+
```ts
349+
// Example: short form requestHandler configuration.
350+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
351+
352+
const client = new DynamoDBClient({
353+
requestHandler: {
354+
requestTimeout: 3_000,
355+
httpsAgent: { maxSockets: 25 },
356+
},
357+
});
358+
```
359+
You can instead pass the constructor parameters directly. The default requestHandler for the platform and service will be used.
360+
For Node.js, most services use `NodeHttpHandler`. For browsers, most services use `FetchHttpHandler`.
361+
362+
Kinesis, Lex Runtime v2, QBusiness, TranscribeStreaming use `NodeHttp2Handler` by default instead in Node.js.
363+
RekognitionStreaming and TranscribeStreaming use the `WebSocketFetchHandler` by default instead in browsers.
364+
365+
This list may change over time. Check the corresponding client's `src/runtimeConfig.ts` source file for up-to-date information.
366+
326367
### Retry Strategy `retryStrategy`, `retryMode`, `maxAttempts`
327368

328369
The SDK's default retry strategy is based on exponential backoff, and only retries

0 commit comments

Comments
 (0)