# IWebSocketStage

Interface · Stable

Represents the WebSocketStage.

Extends: [IStage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IStage.html)
Implemented by: [WebSocketStage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketStage.html)
Obtainable from: [WebSocketStage.fromWebSocketStageAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketStage.html#fromwebsocketstageattributes)

- Source: [`aws-apigatewayv2/lib/websocket/stage.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/stage.ts#L18)
- Type last changed: v2.112.0 · 1 Dec 2023

## Properties

- `api`: [IWebSocketApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IWebSocketApi.html) — The API this stage is associated to.

- `callbackUrl`: string — The callback URL to this stage.

  You can use the callback URL to send messages to the client from the backend system.
  https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html
  https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `stageName`: string — The name of the stage;

  its primary identifier.

- `stageRef`: [StageReference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigatewayv2.StageReference.html) — A reference to a Stage resource.

- `url`: string — The URL to this stage.

## Methods

- `addStageVariable(name: string, value: string): void` — Adds a stage variable to this stage.

  **Parameters**

  - `name` — The name of the stage variable.
  - `value` — The value of the stage variable.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `metric(metricName: string, props?: MetricOptions): Metric` — Return the given named metric for this HTTP Api Gateway Stage.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
