Skip to content

Commit e5b82f9

Browse files
author
Manasvi Jain
committed
changes added
2 parents 460b9dc + 218a7c2 commit e5b82f9

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

ack-connect-route/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## Websocket API Gateway acknowledgement for $connect route.
21

3-
The Serverless Application Model (SAM) template deploys an Amazon WebSocket API Gateway and two AWS Lambda functions. When a client connects, the API Gateway creates a $connect route with Lambda proxy integration. The first Lambda function processes the initial connection, capturing both the Connection ID and API Gateway stage URL, then asynchronously triggers the second Lambda function. This second function validates the Connection ID and, if valid, uses SDK API calls to send a greeting message back to the client.
2+
## Websocket acknowledgement for $connect route in Amazon API Gateway
3+
4+
The Serverless Application Model (SAM) template deploys an Amazon WebSocket API Gateway and two AWS Lambda functions. When a client connects, the API Gateway creates a $connect route with Lambda proxy integration. The first Lambda function processes the initial connection, capturing both the Connection ID and API Gateway stage URL, then asynchronously invokes the second Lambda function. This second function validates the Connection ID and, if valid, uses SDK API calls to send a greeting message back to the client.
45

56
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns
67

@@ -34,13 +35,13 @@ Important: this application uses various AWS services and there are costs associ
3435
* Enter the desired AWS Region
3536
* Allow SAM CLI to create IAM roles with the required permissions.
3637
37-
Once you have run guided mode once, you can use `sam deploy` in future to use these defaults.
38+
After running guided mode once, you can use `sam deploy` in future to use these defaults.
3839
3940
1. Note the outputs from the SAM deployment process. These contain the resource names and/or ARNs which are used for testing.
4041
4142
## Testing
4243
43-
Once the application is deployed, retrieve the WebSocketURL value from CloudFormation Outputs. To test the WebSocket API, you can use [wscat](https://github.com/websockets/wscat) which is an open-source command line tool.
44+
After deployment, retrieve the `WebSocketURL` value from CloudFormation Outputs. To test the WebSocket API, you can use [wscat](https://github.com/websockets/wscat) which is an open-source command line tool.
4445
4546
1. [Install NPM](https://www.npmjs.com/get-npm).
4647
@@ -53,7 +54,7 @@ Once the application is deployed, retrieve the WebSocketURL value from CloudForm
5354
$ wscat -c <YOUR WEBSOCKET URL>
5455
```
5556
56-
4. To test the custom route and its associated function, send a JSON-formatted request. The Lambda function sends back the value of the "data" key using the callback URL:
57+
4. To test the custom route and its associated function, send a JSON-formatted request for example {"Test":"input"}. The Lambda function sends back the value of the "data" key using the callback URL:
5758
```
5859
$ wscat -c <YOUR WEBSOCKET URL>
5960
connected (press CTRL+C to quit)
@@ -62,12 +63,8 @@ connected (press CTRL+C to quit)
6263
6364
1. Delete the stack
6465
```
65-
aws cloudformation delete-stack --stack-name <YOUR STACK NAME>
66+
sam delete
6667
```
6768
68-
2. Confirm the stack has been deleted
69-
```
70-
aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'<YOUR STACK NAME>')].StackStatus"
71-
```
7269
7370

0 commit comments

Comments
 (0)