WebSocketRouteOptions
- class aws_cdk.aws_apigatewayv2.WebSocketRouteOptions(*, integration, authorizer=None, return_response=None)
Bases:
object
Options used to add route to the API.
- Parameters:
integration (
WebSocketRouteIntegration
) – The integration to be configured on this route.authorizer (
Optional
[IWebSocketRouteAuthorizer
]) – The authorize to this route. You can only set authorizer to a $connect route. Default: - No Authorizerreturn_response (
Optional
[bool
]) – Should the route send a response to the client. Default: false
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_apigatewayv2_integrations import WebSocketLambdaIntegration # message_handler: lambda.Function web_socket_api = apigwv2.WebSocketApi(self, "mywsapi") apigwv2.WebSocketStage(self, "mystage", web_socket_api=web_socket_api, stage_name="dev", auto_deploy=True ) web_socket_api.add_route("sendMessage", integration=WebSocketLambdaIntegration("SendMessageIntegration", message_handler) )
Attributes
- authorizer
The authorize to this route.
You can only set authorizer to a $connect route.
- Default:
No Authorizer
- integration
The integration to be configured on this route.
- return_response
Should the route send a response to the client.
- Default:
false