[{"data":1,"prerenderedAt":71},["ShallowReactive",2],{"pattern-apigw-websocket-api-lambda":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":12,"deploy":14,"description":17,"extension":18,"framework":19,"gitHub":20,"highlight":6,"introBox":29,"language":35,"level":36,"meta":37,"patternArch":38,"resources":51,"s3URL":63,"services":64,"stem":65,"testing":66,"videoId":28,"__hash__":70},"patterns\u002Fpatterns\u002Fapigw-websocket-api-lambda.json","Amazon API Gateway WebSocket API to AWS Lambda",null,{"headline":8,"text":9},"Cleanup",[10,11],"1. Delete the stack: \u003Ccode>sam delete --stack-name STACK_NAME\u003C\u002Fcode>.","2. Confirm the stack has been deleted: \u003Ccode>aws cloudformation list-stacks --query \"StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus\"\u003C\u002Fcode>",[13],"content\u002Fcontributors\u002Fjoe-tringali.json",{"text":15},[16],"sam deploy --guided","Create an Amazon API Gateway Websocket API that invokes an AWS Lambda function","json","AWS SAM",{"template":21,"payloads":26},{"projectFolder":22,"repoURL":23,"templateURL":24,"templateFile":25},"apigw-websocket-api-lambda","https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-websocket-api-lambda","serverless-patterns\u002Fapigw-websocket-api-lambda","template.yml",[27],{"headline":28,"payloadURL":28},"",{"headline":30,"text":31,"test":28},"How it works",[32,33,34],"This pattern deploys an Amazon API Gateway WebSocket API with a $connect route, a $disconnect route and a custom route.","The $connect route invokes an AWS Lambda function to record the WebSocket's connection ID to a DynamoDB table.","The custom route is integrated with an AWS Lambda function written in Node.js which returns back the contents of the \"data\" node of a JSON object within the request's body. The $disconnect route invokes a Lambda function to remove the connection ID from the DynamoDB table when the WebSocket connection is closed.","Node.js","200",{},{"icon1":39,"icon2":44,"line1":48},{"x":40,"y":41,"service":42,"label":43},20,50,"apigw","API Gateway WebSocket API",{"x":45,"y":41,"service":46,"label":47},80,"lambda","AWS Lambda",{"from":49,"to":50,"label":28},"icon1","icon2",{"headline":52,"bullets":53},"Additional resources",[54,57,60],{"text":55,"link":56},"Working with WebSocket APIs","https:\u002F\u002Fdocs.aws.amazon.com\u002Fapigateway\u002Flatest\u002Fdeveloperguide\u002Fapigateway-websocket-api.html",{"text":58,"link":59},"Announcing WebSocket APIs in Amazon API Gateway","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fannouncing-websocket-apis-in-amazon-api-gateway\u002F",{"text":61,"link":62},"Lambda Function Handler","https:\u002F\u002Fdocs.aws.amazon.com\u002Fwhitepapers\u002Flatest\u002Fserverless-architectures-lambda\u002Fthe-handler.html","https:\u002F\u002Fda-public-assets.s3.amazonaws.com\u002Fpatterns\u002Fapigw-websocket-api-lambda\u002Fcloudformation.yml",{"from":42,"to":46},"patterns\u002Fapigw-websocket-api-lambda",{"headline":67,"text":68},"Testing",[69],"See the repo for detailed testing instructions.","T3PChoKlEFRQaOm0KgdUaVx5uj4KTuuiX7c64JqHHu8",1778846883037]