Skip to content
v2.278.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,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigatewayv2 as apigatewayv2

# web_socket_api: apigatewayv2.WebSocketApi
# web_socket_route_authorizer: apigatewayv2.IWebSocketRouteAuthorizer
# web_socket_route_integration: apigatewayv2.WebSocketRouteIntegration

web_socket_route_props = apigatewayv2.WebSocketRouteProps(
    integration=web_socket_route_integration,
    route_key="routeKey",
    web_socket_api=web_socket_api,

    # the properties below are optional
    api_key_required=False,
    authorizer=web_socket_route_authorizer,
    return_response=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigatewayv2.*;

WebSocketApi webSocketApi;
IWebSocketRouteAuthorizer webSocketRouteAuthorizer;
WebSocketRouteIntegration webSocketRouteIntegration;

WebSocketRouteProps webSocketRouteProps = WebSocketRouteProps.builder()
        .integration(webSocketRouteIntegration)
        .routeKey("routeKey")
        .webSocketApi(webSocketApi)

        // the properties below are optional
        .apiKeyRequired(false)
        .authorizer(webSocketRouteAuthorizer)
        .returnResponse(false)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Apigatewayv2;

WebSocketApi webSocketApi;
IWebSocketRouteAuthorizer webSocketRouteAuthorizer;
WebSocketRouteIntegration webSocketRouteIntegration;

var webSocketRouteProps = new WebSocketRouteProps {
    Integration = webSocketRouteIntegration,
    RouteKey = "routeKey",
    WebSocketApi = webSocketApi,

    // the properties below are optional
    ApiKeyRequired = false,
    Authorizer = webSocketRouteAuthorizer,
    ReturnResponse = false
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var webSocketApi WebSocketApi
var webSocketRouteAuthorizer IWebSocketRouteAuthorizer
var webSocketRouteIntegration WebSocketRouteIntegration

webSocketRouteProps := &WebSocketRouteProps{
	Integration: webSocketRouteIntegration,
	RouteKey: jsii.String("routeKey"),
	WebSocketApi: webSocketApi,

	// the properties below are optional
	ApiKeyRequired: jsii.Boolean(false),
	Authorizer: webSocketRouteAuthorizer,
	ReturnResponse: jsii.Boolean(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*string required #
The key to this route.
webSocketApiIWebSocketApiweb_socket_apiIWebSocketApiwebSocketApiIWebSocketApiWebSocketApiIWebSocketApiWebSocketApiIWebSocketApi required #
The API the route is associated with.