# WebSocketRouteProps

Properties to initialize a new Route.

Extends: WebSocketRouteProps
Extends: WebSocketRouteOptions
Used as props by: WebSocketRoute

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

## Example

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

declare const webSocketApi: apigatewayv2.WebSocketApi;
declare const webSocketRouteAuthorizer: apigatewayv2.IWebSocketRouteAuthorizer;
declare const webSocketRouteIntegration: apigatewayv2.WebSocketRouteIntegration;
const webSocketRouteProps: apigatewayv2.WebSocketRouteProps = {
  integration: webSocketRouteIntegration,
  routeKey: 'routeKey',
  webSocketApi: webSocketApi,

  // the properties below are optional
  apiKeyRequired: false,
  authorizer: webSocketRouteAuthorizer,
  returnResponse: false,
};
```

## Properties

- `apiKeyRequired`: boolean = false — Whether the route requires an API Key to be provided.

- `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.

- `routeKey`: string (required) — The key to this route.

- `webSocketApi`: [IWebSocketApi](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IWebSocketApi.html) (required) — The API the route is associated with.
