# WebSocketAwsIntegration

AWS WebSocket AWS Type Integration.

Extends: WebSocketRouteIntegration › WebSocketAwsIntegration

- Source: [`aws-apigatewayv2-integrations/lib/websocket/aws.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/websocket/aws.ts#L94)
- Type last changed: v2.123.0 · 24 Jan 2024

## Example

```ts
import { WebSocketAwsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as iam from 'aws-cdk-lib/aws-iam';

const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi');
new apigwv2.WebSocketStage(this, 'mystage', {
  webSocketApi,
  stageName: 'dev',
  autoDeploy: true,
});

declare const apiRole: iam.Role;
declare const table: dynamodb.Table;
webSocketApi.addRoute('$connect', {
  integration: new WebSocketAwsIntegration('DynamodbPutItem', {
    integrationUri: `arn:aws:apigateway:${this.region}:dynamodb:action/PutItem`,
    integrationMethod: apigwv2.HttpMethod.POST,
    credentialsRole: apiRole,
    requestTemplates: {
      'application/json': JSON.stringify({
        TableName: table.tableName,
        Item: {
          id: {
            S: '$context.requestId',
          },
        },
      }),
    },
  }),
});
```

## Initializer

```ts
new WebSocketAwsIntegration(id: string, props: WebSocketAwsIntegrationProps)
```

## Methods

- `bind(_options: WebSocketRouteIntegrationBindOptions): WebSocketRouteIntegrationConfig` — Bind this integration to the route.
