/aws-websocket-demo

Simple demo project to test out aws websocket implementation

Primary LanguageJavaScript

simple-websockets-chat-app

Simple web chat using aws websocket

├── handlers
│   ├── app.js
│   ├── package.json
│   └── utills.js
├── index.html
├── Makefile
├── README.md
├── samconfig.toml
└── template.yaml

Tools

  • AWS SAM CLI / AWS SDK for JavaScript
  • AWS S3
  • AWS API Gateway
  • AWS Lambda
  • AWS DynamoDB
  • AWS CloudWatch Logs

Deploying to your account

make build_and_deploy

Run html app

make run_app

Testing APIs

To test the WebSocket API, you can use wscat, an open-source command line tool.

$ npm install -g wscat
  1. On the console, connect to your published API endpoint by executing the following command:
$ wscat -c wss://{YOUR-API-ID}.execute-api.{YOUR-REGION}.amazonaws.com/{STAGE}
  1. To test the sendmessage:
$ wscat -c wss://{YOUR-API-ID}.execute-api.{YOUR-REGION}.amazonaws.com/prod
connected (press CTRL+C to quit)
> {"action":"sendmessage", "data":"hello world"}
< hello world