interface WebSocketMockIntegrationProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AwsApigatewayv2Integrations.WebSocketMockIntegrationProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2integrations#WebSocketMockIntegrationProps |
Java | software.amazon.awscdk.aws_apigatewayv2_integrations.WebSocketMockIntegrationProps |
Python | aws_cdk.aws_apigatewayv2_integrations.WebSocketMockIntegrationProps |
TypeScript (source) | aws-cdk-lib » aws_apigatewayv2_integrations » WebSocketMockIntegrationProps |
Props for Mock type integration for a WebSocket Api.
Example
import { WebSocketMockIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi');
new apigwv2.WebSocketStage(this, 'mystage', {
webSocketApi,
stageName: 'dev',
autoDeploy: true,
});
webSocketApi.addRoute('sendMessage', {
integration: new WebSocketMockIntegration('DefaultIntegration', {
requestTemplates: { 'application/json': JSON.stringify({ statusCode: 200 }) },
templateSelectionExpression: '\\$default',
}),
returnResponse: true,
});
Properties
| Name | Type | Description |
|---|---|---|
| request | { [string]: string } | A map of Apache Velocity templates that are applied on the request payload. |
| template | string | The template selection expression for the integration. |
requestTemplates?
Type:
{ [string]: string }
(optional, default: No request template provided to the integration.)
A map of Apache Velocity templates that are applied on the request payload.
{ "application/json": "{ \"statusCode\": 200 }" }
templateSelectionExpression?
Type:
string
(optional, default: No template selection expression provided.)
The template selection expression for the integration.

.NET
Go
Java
Python
TypeScript (