Skip to content

Instantly share code, notes, and snippets.

@leantorres73
Created January 14, 2021 15:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leantorres73/a14e7a589a6f270fb44190a05594d15b to your computer and use it in GitHub Desktop.
Save leantorres73/a14e7a589a6f270fb44190a05594d15b to your computer and use it in GitHub Desktop.
// connect route
const apigatewayroutesocketconnect = new apigateway.CfnRoute(this, "apigatewayroutesocketconnect", {
apiId:apigatewaysocket.ref,
routeKey: "$connect",
authorizationType: "AWS_IAM",
apiKeyRequired: false,
operationName: "ConnectRoute",
target: "integrations/"+new apigateway.CfnIntegration(this, "apigatewayintegrationsocketconnect", {
apiId: apigatewaysocket.ref,
integrationType: "AWS_PROXY",
integrationUri: "arn:aws:apigateway:" + Stack.of(this).region + ":lambda:path/2015-03-31/functions/" + lambdaAPIsocket.functionArn+"/invocations",
credentialsArn: roleapigatewaysocketapi.roleArn
}).ref
});
// disconnect route
const apigatewayroutesocketdisconnect = new apigateway.CfnRoute(this, "apigatewayroutesocketdisconnect", {
apiId:apigatewaysocket.ref,
routeKey: "$disconnect",
apiKeyRequired: false,
authorizationType: "NONE",
operationName: "DisconnectRoute",
target: "integrations/"+new apigateway.CfnIntegration(this, "apigatewayintegrationsocketdisconnect", {
apiId:apigatewaysocket.ref,
integrationType: "AWS_PROXY",
integrationUri: "arn:aws:apigateway:"+Stack.of(this).region+":lambda:path/2015-03-31/functions/" + lambdaAPIsocket.functionArn + "/invocations",
credentialsArn: roleapigatewaysocketapi.roleArn
}).ref
});
// message route
const apigatewayroutesocketdefault = new apigateway.CfnRoute(this, "apigatewayroutesocketdefault", {
apiId:apigatewaysocket.ref,
routeKey: "$default",
apiKeyRequired: false,
authorizationType: "NONE",
operationName: "SendRoute",
target: "integrations/"+new apigateway.CfnIntegration(this, "apigatewayintegrationsocketdefault", {
apiId:apigatewaysocket.ref,
integrationType: "AWS_PROXY",
integrationUri: "arn:aws:apigateway:"+Stack.of(this).region+":lambda:path/2015-03-31/functions/"+lambdaAPIsocket.functionArn+"/invocations",
credentialsArn: roleapigatewaysocketapi.roleArn
}).ref
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment