Skip to content
v2.274.0

WebSocketRouteProps Struct ​

Properties to initialize a new Route.

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 ​

apiKeyRequiredoptionalbooleanapi_key_requiredoptionalboolapiKeyRequiredoptionalBooleanApiKeyRequiredoptionalboolApiKeyRequiredoptional*bool= false#
Whether the route requires an API Key to be provided.
authorizeroptionalIWebSocketRouteAuthorizerauthorizeroptionalIWebSocketRouteAuthorizerauthorizeroptionalIWebSocketRouteAuthorizerAuthorizeroptionalIWebSocketRouteAuthorizerAuthorizeroptionalIWebSocketRouteAuthorizer#
The authorize to this route.

Default: No Authorizer

You can only set authorizer to a $connect route.

The integration to be configured on this route.
returnResponseoptionalbooleanreturn_responseoptionalboolreturnResponseoptionalBooleanReturnResponseoptionalboolReturnResponseoptional*bool= false#
Should the route send a response to the client.
routeKeystringroute_keystrrouteKeyStringRouteKeystringRouteKey*stringrequired#
The key to this route.
webSocketApiIWebSocketApiweb_socket_apiIWebSocketApiwebSocketApiIWebSocketApiWebSocketApiIWebSocketApiWebSocketApiIWebSocketApirequired#
The API the route is associated with.