constructor()

in cdk/lib/construct/websocket.ts [23:48]


    constructor(scope: Construct, id: string, props: WebSocketProps) {
        super(scope, id);

        const authorizer = new agwa.WebSocketLambdaAuthorizer("Authorizer", props.authHandler, {
            identitySource: [`route.request.querystring.${props.querystringKeyForIdToken ?? "idToken"}`],
        });

        this.api = new agw.WebSocketApi(this, "Api", {
            connectRouteOptions: {
                authorizer,
                integration: new agwi.WebSocketLambdaIntegration("ConnectIntegration", props.websocketHandler),
            },
            disconnectRouteOptions: {
                integration: new agwi.WebSocketLambdaIntegration("DisconnectIntegration", props.websocketHandler),
            },
            defaultRouteOptions: {
                integration: new agwi.WebSocketLambdaIntegration("DefaultIntegration", props.websocketHandler),
            },
        });

        new agw.WebSocketStage(this, `Stage`, {
            webSocketApi: this.api,
            stageName: this.defaultStageName,
            autoDeploy: true,
        });
    }