WebSocketStageProps

class aws_cdk.aws_apigatewayv2.WebSocketStageProps(*, auto_deploy=None, domain_mapping=None, throttle=None, stage_name, web_socket_api)

Bases: StageOptions

Properties to initialize an instance of WebSocketStage.

Parameters:
  • auto_deploy (Optional[bool]) – Whether updates to an API automatically trigger a new deployment. Default: false

  • domain_mapping (Union[DomainMappingOptions, Dict[str, Any], None]) – The options for custom domain and api mapping. Default: - no custom domain and api mapping configuration

  • throttle (Union[ThrottleSettings, Dict[str, Any], None]) – Throttle settings for the routes of this stage. Default: - no throttling configuration

  • stage_name (str) – The name of the stage.

  • web_socket_api (IWebSocketApi) – The WebSocket API to which this stage is associated.

ExampleMetadata:

infused

Example:

from aws_cdk.aws_apigatewayv2_integrations import WebSocketLambdaIntegration

# connect_handler: lambda.Function
# disconnect_handler: lambda.Function
# default_handler: lambda.Function


web_socket_api = apigwv2.WebSocketApi(self, "mywsapi",
    connect_route_options=apigwv2.WebSocketRouteOptions(integration=WebSocketLambdaIntegration("ConnectIntegration", connect_handler)),
    disconnect_route_options=apigwv2.WebSocketRouteOptions(integration=WebSocketLambdaIntegration("DisconnectIntegration", disconnect_handler)),
    default_route_options=apigwv2.WebSocketRouteOptions(integration=WebSocketLambdaIntegration("DefaultIntegration", default_handler))
)

apigwv2.WebSocketStage(self, "mystage",
    web_socket_api=web_socket_api,
    stage_name="dev",
    auto_deploy=True
)

Attributes

auto_deploy

Whether updates to an API automatically trigger a new deployment.

Default:

false

domain_mapping

The options for custom domain and api mapping.

Default:
  • no custom domain and api mapping configuration

stage_name

The name of the stage.

throttle

Throttle settings for the routes of this stage.

Default:
  • no throttling configuration

web_socket_api

The WebSocket API to which this stage is associated.