Skip to content
v2.273.0

WebSocketIntegrationProps Struct ​

The integration properties.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';

declare const role: iam.Role;
declare const webSocketApiRef: apigatewayv2.IWebSocketApiRef;
const webSocketIntegrationProps: apigatewayv2.WebSocketIntegrationProps = {
  integrationType: apigatewayv2.WebSocketIntegrationType.AWS_PROXY,
  integrationUri: 'integrationUri',
  webSocketApi: webSocketApiRef,

  // the properties below are optional
  contentHandling: apigatewayv2.ContentHandling.CONVERT_TO_BINARY,
  credentialsRole: role,
  integrationMethod: 'integrationMethod',
  passthroughBehavior: apigatewayv2.PassthroughBehavior.WHEN_NO_MATCH,
  requestParameters: {
    requestParametersKey: 'requestParameters',
  },
  requestTemplates: {
    requestTemplatesKey: 'requestTemplates',
  },
  templateSelectionExpression: 'templateSelectionExpression',
  timeout: cdk.Duration.minutes(30),
};

Properties ​

contentHandlingContentHandlingcontent_handlingContentHandlingcontentHandlingContentHandlingContentHandlingContentHandlingContentHandlingContentHandling= The response payload will be pas…#
Specifies how to handle response payload content type conversions.
default

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

credentialsRoleIRolecredentials_roleIRolecredentialsRoleIRoleCredentialsRoleIRoleCredentialsRoleIRole= No IAM role required.#
Specifies the IAM role required for the integration.
integrationMethodstringintegration_methodstrintegrationMethodStringIntegrationMethodstringIntegrationMethod*string= No HTTP method required.#
Specifies the integration's HTTP method type.
integrationTypeWebSocketIntegrationTypeintegration_typeWebSocketIntegrationTypeintegrationTypeWebSocketIntegrationTypeIntegrationTypeWebSocketIntegrationTypeIntegrationTypeWebSocketIntegrationTyperequired#
Integration type.
integrationUristringintegration_uristrintegrationUriStringIntegrationUristringIntegrationUri*stringrequired#
Integration URI.
passthroughBehaviorPassthroughBehaviorpassthrough_behaviorPassthroughBehaviorpassthroughBehaviorPassthroughBehaviorPassthroughBehaviorPassthroughBehaviorPassthroughBehaviorPassthroughBehavior= No passthrough behavior required…#
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

Default: No passthrough behavior required.

requestParameters{ [key: string]: string }request_parameterstyping.Mapping[str, str]requestParametersMap<String, String>RequestParametersIDictionary<string, string>RequestParameters*map[string]*string= No request parameters required.#
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.

requestTemplates{ [key: string]: string }request_templatestyping.Mapping[str, str]requestTemplatesMap<String, String>RequestTemplatesIDictionary<string, string>RequestTemplates*map[string]*string= No request templates required.#
A map of Apache Velocity templates that are applied on the request payload.
  { "application/json": "{ \"statusCode\": 200 }" }
templateSelectionExpressionstringtemplate_selection_expressionstrtemplateSelectionExpressionStringTemplateSelectionExpressionstringTemplateSelectionExpression*string= No template selection expression…#
The template selection expression for the integration.
default

Default: No template selection expression required.

timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration= Duration.seconds(29)#
The maximum amount of time an integration will run before it returns without a response.

Must be between 50 milliseconds and 29 seconds.

webSocketApiIWebSocketApiRefweb_socket_apiIWebSocketApiRefwebSocketApiIWebSocketApiRefWebSocketApiIWebSocketApiRefWebSocketApiIWebSocketApiRefrequired#
The WebSocket API to which this integration should be bound.

Used as props by ​