# WebSocketRouteOptions

Options used to add route to the API.

- Source: [`aws-apigatewayv2/lib/websocket/route.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/route.ts#L34)
- Type last changed: v2.112.0 · 1 Dec 2023

## Example

```ts
import { WebSocketLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';

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

declare const messageHandler: lambda.Function;
webSocketApi.addRoute('sendMessage', {
  integration: new WebSocketLambdaIntegration('SendMessageIntegration', messageHandler),
});
```

## Properties

- `authorizer`: [IWebSocketRouteAuthorizer](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IWebSocketRouteAuthorizer.html) — The authorize to this route.

  **Default:** No Authorizer

  You can only set authorizer to a $connect route.

- `integration`: [WebSocketRouteIntegration](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketRouteIntegration.html) (required) — The integration to be configured on this route.

- `returnResponse`: boolean = false — Should the route send a response to the client.
