# WebSocketMockIntegration

Mock WebSocket Integration.

Extends: WebSocketRouteIntegration › WebSocketMockIntegration

- Source: [`aws-apigatewayv2-integrations/lib/websocket/mock.ts`](https://github.com/aws/aws-cdk/blob/v2.276.0/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/websocket/mock.ts#L38)
- Type last changed: v2.176.0 · 15 Jan 2025

## Example

```ts
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,
});
```

## Initializer

```ts
new WebSocketMockIntegration(id: string, props?: WebSocketMockIntegrationProps)
```

## Methods

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