Skip to content
v2.273.0

WebSocketRouteOptions Struct ​

Options used to add route to the API.

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 ​

The authorize to this route.

You can only set authorizer to a $connect route.

The integration to be configured on this route.
returnResponsebooleanreturn_responseboolreturnResponseBooleanReturnResponseboolReturnResponse*bool= false#
Should the route send a response to the client.