WebSocketRouteOptions

class aws_cdk.aws_apigatewayv2.WebSocketRouteOptions(*, integration, authorizer=None)

Bases: object

(experimental) Options used to add route to the API.

Parameters
  • integration (WebSocketRouteIntegration) – (experimental) The integration to be configured on this route.

  • authorizer (Optional[IWebSocketRouteAuthorizer]) – (experimental) The authorize to this route. You can only set authorizer to a $connect route. Default: - No Authorizer

Stability

experimental

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

(experimental) The authorize to this route.

You can only set authorizer to a $connect route.

Default
  • No Authorizer

Stability

experimental

Return type

Optional[IWebSocketRouteAuthorizer]

integration

(experimental) The integration to be configured on this route.

Stability

experimental

Return type

WebSocketRouteIntegration