AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

WebSocketIntegration

The integration for an API route.

Import

import { WebSocketIntegration } from 'aws-cdk-lib/aws-apigatewayv2';

Or use the module namespace:

import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
// apigatewayv2.WebSocketIntegration

Properties

Configuration passed to the constructor as WebSocketIntegrationProps.

integrationTypeRequired
WebSocketIntegrationType

Integration type.

integrationUriRequired
string

Integration URI.

webSocketApiRequired
IWebSocketApiRef

The WebSocket API to which this integration should be bound.

contentHandlingOptional
ContentHandling

Specifies how to handle response payload content type conversions.

Default: - The response payload will be passed through from the integration response to the route response or method response without modification.

credentialsRoleOptional
IRole

Specifies the IAM role required for the integration.

Default: - No IAM role required.

integrationMethodOptional
string

Specifies the integration's HTTP method type.

Default: - No HTTP method required.

passthroughBehaviorOptional
PassthroughBehavior

Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource. There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and NEVER.

Default: - No passthrough behavior required.

requestParametersOptional
{ [key: string]: string }

The request parameters that API Gateway sends with the backend request. Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value.

Default: - No request parameters required.

requestTemplatesOptional
{ [key: string]: string }

A map of Apache Velocity templates that are applied on the request payload. ``` { "application/json": "{ \"statusCode\": 200 }" } ```

Default: - No request templates required.

templateSelectionExpressionOptional
string

The template selection expression for the integration.

Default: - No template selection expression required.

timeoutOptional
Duration

The maximum amount of time an integration will run before it returns without a response. Must be between 50 milliseconds and 29 seconds.

Default: Duration.seconds(29)

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter